Java applications usually start by batch files or shell scripts which among other things set the executable java from the JRE_HOME or JAVA_HOME or the PATH environment variables. What are the best practices in writing such scripts and setting the PATH and JRE_HOME and JAVA_HOME considering the following factors:
-security -convenience for average end users -multiple versions of JRE/JDK in the same machine
Should we find 'java' from the PATH, JRE_HOME or JAVA_HOME?
JAVA_HOME should be set to the home folder of your JDK - typically C:\jdk1.6.0_05 (or whatever version and wherever you installed it).
JRE_HOME is hardly ever needed - I've never ever set it before.
PATH should include "%JAVA_HOME%\bin" for Windows or $JAVA_HOME/bin for Linux / Unix / ... Depending on whether or not JAVA_HOME contains any spaces you'd want to put the entire path, including the \bin, in quotes.