官术网_书友最值得收藏!

Switching between JDKs

Once you've installed a newer version of the JDK with an earlier version already installed, it is possible to switch what the currently selected version is.

On macOS and Linux, you do this by switching the value of JAVA_HOME

The following command switches the current Java platform to Java 8:

$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

To switch to Java 9, use the following command:

$ export JAVA_HOME=$(/usr/libexec/java_home -v 9)
With this command, you are passing the Java version of choice to the -v parameter. But, note that the format is different between Java 8 and 9. With Java 8, the version string is 1.8. With Java 9, the version string is just 9. Traditionally, Java has been using the 1.X version format, for example, Java version 7 had the version string 1.7. This is being changed from Java 9 onward. The idea is that subsequent releases of Java will drop the 1.X format and just use a single number to denote the format. So it's Java 9, not Java 1.9.

It's about time this was changed! Imagine the confusion Java 10 would have caused!

On Windows, you switch JDK versions by changing the JAVA_HOME and PATH variables. Follow the same steps as earlier to get to the Environment Variables section. Update the value of JAVA_HOME to point to the location where the version you need is installed. Also, make sure the PATH is updated to point to the corresponding folder for the Java version you'd like to switch to.

主站蜘蛛池模板: 栾川县| 梨树县| 留坝县| 呼伦贝尔市| 申扎县| 泰宁县| 如东县| 大田县| 衡水市| 临江市| 辉县市| 海林市| 宁陕县| 凤凰县| 景洪市| 台江县| 遂平县| 故城县| 安阳县| 长治县| 宜阳县| 原平市| 河南省| 县级市| 双峰县| 平乡县| 青海省| 赤城县| 太湖县| 芷江| 鱼台县| 宣化县| 吉木萨尔县| 宁强县| 新蔡县| 潼南县| 阿拉善右旗| 扬州市| 襄城县| 蒙山县| 肇庆市|