I run Java on MacOS Monterey(12.6) and have two versions of JDKs installed:
user@Users-iMac ~ % ls /Library/Java/JavaVirtualMachines/
jdk-17.0.2.jdk openjdk-8.jdk
I want to work with Java 17. My concern is that the command java -version
generates the info that I do NOT want:
user@Users-iMac ~ % java -version
openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build 1.8.0_362-bre_2023_01_22_03_30-b00)
whereas the command echo $JAVA_HOME
displays the correct version that I DO want
user@Users-iMac ~ % echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home
How can I make `java -version make point to Java 17 instead of Java 8?
Thanks
Singham