Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Changing MacOS java version, Eclipse OpenJ9

I am using MacOS BigSur, trying to change java version to v1.8
I have followed the instructions from this question but no results.

/usr/libexec/java_home -V commands outputs:

Matching Java Virtual Machines (1):
    1.8.0_292 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

But java --version command returns:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
Eclipse OpenJ9 VM AdoptOpenJDK-11.0.11+9 (build openj9-0.26.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20210421_957 (JIT enabled, AOT enabled)
OpenJ9   - b4cc246d9
OMR      - 162e6f729
JCL      - 7796c80419 based on jdk-11.0.11+9)

When I removed java completely from the OS following these instructions I would still get the same java --version output, but running /usr/libexec/java_home
would return

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

.zshrc file has JAVA_HOME set to /usr/libexec/java_home -v 1.8.0_265

Where can I find this java that is currently referenced with the java command, or where can I change that reference on the command?

>Solution :

There is a very easy way of managing JDK installations almost automatically using something like SDKMAN. I suggest you have a look at this, as it would greatly simplify the process of managing whatever is that you need to manage. Note that the solution work for both MacOS and Linux.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading