To eclipse use a specific installation of java, it can be configured in the file eclipse.ini
:
You have to add the argument vm and the path to bin\javaw.exe
of the java installation:
Example:
-vm
C:\mi\instalacion\java8\bin\javaw.exe
Important:
1) The path is in the line following the argument ( -vm
)
2) This argument must be before (above) the argument -vmargs
3) The path should not have spaces, if it were the case, use the name of the directory shown in a " dir
" of cmd
(containing the character ~
)
Clarification : This is the JVM that will use eclipse to run, it is independent of the JVM or JDK that is then configured for projects.
Ref: Eclipse.ini
If I currently run on my PC any program that requires the
jvm which one would you use, since according to the command line (java -version)
this would use java 8 however in the windows environment variables
points to java 6
If you execute java
from the command line, it will take the first occurrence of your environment variable PATH
Otherwise, look at the Java control panel (in control panel of windows), there is the version that the system will use by default. Those values, if I'm not mistaken, are saved in the registry.
JAVA_HOME is an environment variable to save the root of the java directory that you want to use, but it is up to the application to use that variable or not.
One use that you can give, for example, is to set the JAVA_HOME, and set the PATH based on the JAVA_HOME. That way, when you change the JAVA_HOME, you indirectly change the java version that is executed from the command line.