Pages

Sunday, January 15, 2012

Setting Java Path

Seems like many are having troubles with setting the Java path in Windows. So thought of writing some tips regarding the common issues the students came across.


  • To see if JDK is installed, type 'java' in command prompt and enter.
If it is installed you will get a message like above. If not try installing the JDK. Or if you are sure it is already installed try setting the path (see below).


  • Use 'javac' command to see if the path is set.
It will display like above if the path is set. Otherwise it will say something like:


In that sort f a situation you need to set the path. Setting path means you are locating the java compiler to compile java programs.



  • Setting the Path
In cmd type the path for the bin folder of jdk you installed as below:



► It is highly recommended to use the tab key to generate the path than type it manually to avoid spelling mistakes.

► Make sure you do not keep spaces before or after the '=' sign

► Try 'javac' command again to confirm that you set the path correctly.

► A path may exist only for that particular command prompt. Once you open a new cmd you will have to set the path again.

► To avoid setting the java path again and again you can create an environment variable for the path. (Will explain later..)

No comments: