- Modular Programming in Java 9
- Koushik Kothagal
- 252字
- 2021-07-02 18:38:19
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!
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.
推薦閱讀
- PHP基礎(chǔ)案例教程
- arc42 by Example
- C/C++常用算法手冊(cè)(第3版)
- Learning Python Design Patterns(Second Edition)
- 高級(jí)C/C++編譯技術(shù)(典藏版)
- Expert Android Programming
- Spring Boot企業(yè)級(jí)項(xiàng)目開(kāi)發(fā)實(shí)戰(zhàn)
- C程序設(shè)計(jì)實(shí)踐教程
- Teaching with Google Classroom
- Python數(shù)據(jù)結(jié)構(gòu)與算法(視頻教學(xué)版)
- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- Test-Driven Development with Django
- C++ Application Development with Code:Blocks
- Visual FoxPro 6.0程序設(shè)計(jì)
- Software Development on the SAP HANA Platform