Java environment variables

0

enter the description of the image hereintroduce the description of the image here Forgive if the question is very elementary. I had version 6 of java installed on my pc. When trying to start eclipse Oxygen did not work with that version so I installed version 8 of java. Without changing the windows environment variables (JAVA_HOME, etc) I have executed from the command line a java -version and the answer has been java 8 and the eclipse has started. However, the environment variables still point to java 6. I do not know if it has to do with whether the variables are from the System or the User pq I have seen different path. You can advise me documentation where to clarify my doubts. Thank you very much

    
asked by Alex 16.12.2018 в 13:11
source

1 answer

1

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.

    
answered by 16.12.2018 / 17:18
source