Saturday, January 21, 2012

How to Set Path for Java Unix Linux and Windows

Before We Run Any Program In Java ,We Need To Set Java Path. Java Path Is One Of The Fundamental Concept Everyone Should know Before Start Playing with Programming.


What is Path? 
PATH: is a system variable used to tel to OS all locations of exec files.
For Example:-If Installation of JAVA JDk Is done Correctly then all your java,javac,Applet Viewer,Jar etc Will be located in C:\java\bin .The Commands Are Useful To run Programs.
But these commands can be used by only that location, in case if you want To Run the program in different location,You'll Get An error AS Your CMD prompt is 'nt Smart Enough To Know The Exact Location Of Commands. As a Result Your CMD Simply says Command not recognized or Not Found.


Setting Up Java Path is Very Important And Simple Task. It Can Be done in Two Ways Either by command prompt or by using windows advanced environment editor.
First Thing Before Setting Up Path Check whether the path is already set or not, on command prompt type “javac”.




If You Find Above Messages Then Path is already Set, Otherwise Follow The Tutorial.


1.Setting Up Path In Command Prompt.


This Method is Simple Way Of Setting Up Path.We Use "set" command to set value of PATH environment variable as shown in below example:
C:\Documents and Settings>set PATH=%PATH%; C:\Program Files\Java\jdk1.6.0_26\bin



C:\Documents and Settings>set PATH=%PATH%; C:\Program Files\Java\jdk1.6.0_26\bin



Here %PATH% is Current Path.


2.Setting Up Path Using Environment variables.



1.Right Click My Computer-->Properties

2.Click on Advanced System Settings

3.Click on Environment Variables

4.In System Variables,Select path and Click Edit.

5.Copy The Bin Path of Java Directory.

6.Save it.

7.We Are Done.

Follow The Video .



How to set Java PATH in UNIX or Linux


To Set Path In UNIX Or Linux  just open any shell(terminal)  and execute below command



set PATH=${PATH}:/home/opt/jdk1.6.0_26/bin





Enhanced by Zemanta

No comments:

Post a Comment