I am trying to change the default Java version on my machine from version 15 (i.e. openjdk 15.0.1) to version 11 (i.e. openjdk version 11.0.2). I have followed various solutions provided online, but at the end of the day, I just want the following result:
$ java --version
openjdk 11.0.9 2020-10-20
OpenJDK Runtime Environment (build 11.0.9+9)
OpenJDK 64-Bit Server VM (build 11.0.9+9, mixed mode, sharing)
But instead, I get:
$ java --version
openjdk 15.0.1 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9)
OpenJDK 64-Bit Server VM (build 15.0.1+9, mixed mode, sharing)
Most solutions that I've found, suggest setting a new value to my JAVA HOME
environmental variable (both in-line and in .bash_profile
), where as of now, I have as:
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-11.0.9.jdk/Contents/Home
Even removing jdk-15.0.1.jdk
entirely from /Library/Java/JavaVirtualMachines/
didn't seem to change anything. So, this JDK must be defined and used somewhere else, and its existance is overriding anything I put in my .bash_profile
file. Has anyone else experienced this before? Is this change possible?