1. PATH env Variable
It is used to search for the command directory When we use the console type commands. We only can use the javac and java command anywhere after the jdk\bin and jdk\jre\bin Directory has been added in to the PATH env variable.
e.g. "C:\Program files\java\jdk1.6.0_21\ bin; C:\Program files\java\jdk1.6.0_21\jre\bin", the ';' is the separator between env Variables.
2. CLASSPATH env Variable
It is used to search the known classes, which include the default classes used by JVM and the current CL Asses we created. Thus we add '.' directory including the classes in current directory, and the Jdk\lib\dt.jar an D Jdk\lib\tools.jar including the default classes JVM would use.
e.g. ".; C:\Program files\java\jdk1.6.0_21\lib\Dt.jar; C:\Program files\java\jdk1.6.0_21\lib\tools.jar".
3. Java_home env Variable
It is used to indicate the directory of JDK. Many softwares like Eclipse, NetBeans, Tomcat would use this env variable to execute JDK.
e.g, "C:\Program files\java\jdk1.6.0_21".
Concrete Steps:
As all the env variables would involve the directory of JDK, we can set the Java_home first. Then we can use the %java_home% make and other env variables setting simple.
1. Java_home=C:\Program files\java\jdk1.6.0_21
2. path=%java_home%\ bin;%java_home%\jre\bin
3. classpath=.; %java_home%\lib\Dt.jar;%java_home%\lib\Tools.jar
.
Java environment variables and their functionality