Home > front end >  Can Eclipse respect JAVA_HOME or path environment variable order?
Can Eclipse respect JAVA_HOME or path environment variable order?

Time:01-16

In order to change the VM used by Ecipse, I have to change eclipse.ini, which is not convenient, because I have manually edit the file whenever I download a new copy. It's a pain if you have several machines to deploy.

Seems eclipse does not respect JAVA_HOME or path environment variable order. Etc,

  1. It cannot load the JVM specified by JAVA_HOME.
  2. It cannot load the JVM which is the first java.exe under path environment variable.

Is there workaround to make Eclipse to respect JAVA_HOME or path environment variable order? Or does Eclipse.exe accept some parameter to allow it to specify the JVM when it starts?

Thanks.

CodePudding user response:

You are right. Eclipse does not respect JAVA_HOME environment variable which is mentioned as the follows from this:

If a JVM is installed in the eclipse/jre directory, Eclipse will use it; otherwise the launcher will consult the eclipse.ini file and the system path variable. Eclipse DOES NOT consult the JAVA_HOME environment variable.

But it does provide command line argument -vm to directly specify a JVM to run it. Different OS has the own value format , refer this for more details.

So in case of the MacOS , you can execute something like the follows to directly configure a JVM to start Eclipse :

eclipse -vm $JAVA_HOME/bin
  •  Tags:  
  • Related