
You need to increase or decrease the installed JDK according to your actual situation.

zshrc, and then you can easily switch the JDK version. To facilitate switching, paste the following alias configuration to the corresponding Shell's configuration file. Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode) ➜ ~ export JAVA_HOME=`/usr/libexec/java_home -v 1.7` The Shell environment only needs to specify the JAVA_HOME environment variable. Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode) Switch the JDK of Shell to the specified version Java(TM) SE Runtime Environment (build 1.7.0_80-b15) usr/libexec/java_home -v version -exec command ➜ ~ /usr/libexec/java_home -v 1.7 -exec java -version You can perform a single task through the exec option of Java home. Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home Switch JDK Execute a single command using the specified JDK Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home Returns the latest JDK to which the prefix matches. You can filter the version number through / usr / libexec / java_home - V. Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home View the installed JDK version and directoryġ.8.0_222, x86_64: "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Homeġ.8.0_201, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Homeġ.7.0_80, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode) View the current JDK installation directory ➜ ~ /usr/libexec/java_home OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)

View the current JDK version ➜ ~ java -version
Apple java version mac os#
At the same time, a small tool / usr/libexec/java_home is provided to help us quickly view JDK related information.īy default, Mac OS will automatically select the JDK with the highest version number under the / Library/Java/JavaVirtualMachines directory as the default JDK. JDK is installed in the directory of / Library/Java/JavaVirtualMachines by default under Mac OS. In this way, our Mac OS default JDK becomes the adoptopenjdk-8.
Apple java version install#
If you install both adoptopenjdk 11 and adoptopenjdk 8, and want 8 as the default JDK, you only need to change the value of JVMVersion in / Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/ist from 1.8.0_tox1.8.0_ (about line 42).
