# how to set java env variables

nancy andrew
Ranch Hand
Posts: 30
Hi all,

Please let me know what will be the value of PATH, CLASSPATH and JAVA_HOME in environment variables.

Currently i have set:

PATH = C:\Program Files\Java\jdk1.5.0_09\bin;
JAVA_HOME = C:\Program Files\Java\jdk1.5.0_09;
CLASSPATH = ?

I remember that somethin is set uptill C:\Program Files\Java\jdk1.5.0_09\lib\tools.jar;

I dont know what is that. Kindly tell me what will be the classpath and where to set tools.jar

fred rosenberger
lowercase baba
Bartender
Posts: 12342
39
I don't think we can answer all that. Environment variables are custom to your own setup. However...

Most folks here would recommend beginners DON'T set a CLASSPATH variable at all. It should not exist.

Your PATH should have lots of directories in it, most likely. Mine looks like this:

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Lenovo;C:\Program Files\Lenovo\Client Security Solution;c:\Program Files\Altiris\Software Virtualization Agent\;C:\Novell\GroupWise;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program Files\Java\jdk1.6.0_23\bin;C:/Python27

it contains the directories for programs you frequently run.

And I don't have a 'java_home' set on my machine.

Jesper de Jong
Java Cowboy
Sheriff
Posts: 15715
73
tools.jar does not need to be added to any environment variable.

PATH is for the operating system, so that it knows where to find executables such as the Java compiler (javac.exe) and other tools that are in the bin directory of the JDK.

CLASSPATH is for Java, it contains the directories and JAR files that it should search for *.class files. You normally do not need to set this.

JAVA_HOME is not necessary for Java. Some programs use this to find the directory where the JDK is installed, but unless you have a program that needs this, you do not need to set it.

So the only thing you really need to do is add the bin directory of the JDK to your PATH variable, but you already seem to have done this.