Is there a comprehensive list of these variables? And what are they specifically used for. For example, JAVA_HOME and CLASSPATH are pretty obvious, but when is JRE_HOME used? When the JDK is not install but only the JRE?

09-07-2012, 11:01 AM

Tolls

Re: Java environmental variables

JAVA_HOME and JRE_HOME are used by some Java apps (eg Tomcat) so they know where Java is installed. The former should point to a JDK and the latter to a JRE.
They aren't needed for your own stuff unless your own stuff needs to know where to find Java.

CLASSPATH is the fallback for where the JVM looks to find classes when it is asked to run a program.
You should generally not use the CLASSPATH environment variable other than declaring in a batch file (ie local to an execution call). You'll normally either use that BAT file or you'd use the -cp (-classpath) switch for java/javac to tell it where your classes are located.