Cannot use Java 7 installation if Java 8 is installed

后端 未结 6 1183
野的像风
野的像风 2021-02-09 23:27

I normally still use Java 7 for all my coding projects (it\'s a company \"politics\" issue), but I installed Java 8 for one third-party project I am contributing to. Now, it see

6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-10 00:03

    You can select the JRE version from the command line with the -version: option.

    > java -version:"1.7" MyClass
    

    should select the 1.7 JRE if installed properly.

    The list of the properly installed JRE is in the registry, see the key :

    HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment  (32bit)
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment  (64bit)
    

    You can set the "CurrentVersion" there if you want a different default version than the latest.

    See http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html#options

    Don't modify your PATH to point to a particuliar JRE, let the special java.exe in Windows/system32 do the job.

提交回复
热议问题