简体   繁体   中英

Choosing which Java executable to run on Windows

I got applications that need different versions of Java to run properly. I noticed that C:\\ProgramData\\Oracle\\Java\\javapath gets highest precedence in the PATH variable. This folder contains java.exe , javaw.exe , and javaws.exe . These appear to be symbolic links that point to, in my case, executable targets in C:\\Program Files (x86)\\Java\\jre1.8.0_40\\bin .

Without using mklink to modify the targets to use another JRE, is there a better way to change the JRE to use?

If you need that eclipse run itself under a specific jvm, check this link: Eclipse.ini ... Then,

add the -vm option at eclipse.ini file; eg -vm C:\\Program Files\\Java\\jre7\\bin\\javaw.exe

You can select the JVM version by passing on the command line the argument -version:release

See http://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BABDJJFI

if those apps need different versions of java, you can launch them using a batch file and invoking say

c:\somepath\java.exe -jar pathToSomeJAR 

or if they have the classes flat out in a folder you can do

c:\somepath\java.exe someClassWithStaticMainMethod.class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM