I have installed the J2SE SDK 1.5, the environment variable (user variable) JAVA_HOME is well set to C:\Program Files\Java\jdk1.5.0_08 but the command "javac" does not work. It works only if i am in the bin sub directory of the directory above.
Various Environment Variables: ------------------------------ PATH: Path of the Folder/Directory which contains the executable(.exe) files should present in PATH. Generally every application keeps there .exe files in BIN directory.(e.x. JDK, Tomcat, JBoss ...etc) thus for example: for J2SDK installed in the following location then C:\j2sdk1.4.1_03\bin should be there in PATH variable.
CLASSPATH: This environment variable keeps track of all the class files which we want to make available for "Compiler Search". If you want your class to be found by javac tool, mention the location of the file(s) in CLASSPATH variable or put that file in the directory from where you are running javac command.
JAVA_HOME: Is the way to tell a Tool (ex. Tomcat ) that my JDK is installed in the specified location. Actually These tools use JAVA_HOME environment variable as the part of the implementation of various functionality knowing the fact that user can install the JDK at any location so providing a user flexibility and to generalize their functionality implementation JAVA_HOME comes into picture.