简体   繁体   中英

Having jdk 8 and jdk 6 installed on Windows how to choose the default version to use (jdk 6)?

for my job I need to use the jdk 6 but I started installing the jdk 8 because I prefer to use Netbeans 8 that requires it. After that I installed also the jdk 6 and I'm able to manage the two java platforms from my ide (I can configure Netbeans to use the jdk 6 when it compiles my company projects). The problem is that I'm unable to configure the java default version used by my os (I use windows 7 64). In particular from the command prompt, if I type java -version it tells me that I'm using Java 8. I want to use the version 6 in general and to use jdk 8 just for Netbeans. I started trying to modify the JAVA_HOME system property but it was not setted at all (neither with the path of jdk 8 ?!?!? ) so I create a new JAVA_HOME with the path of JDK 6 but it seems that the jdk 8 mechanism has the priority because the prompt version displayed is still java 8! Anyone could help me to switch to version 6 please?

It is the PATH environmental variable that sets what JDK version your command line uses. Here is a step by step tutorial on how to edit your PATH https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

Just set it to the bin specific for the JDK you want to use.

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