If you don't have a java version requirement, and/or you want the latest version of openJDK, you can simply issue the following at the command line.
brew install openjdk
On January 28, 2022 the latest version available was 17.
I had a tool that required openJDK 15. I was getting this error:
class com.oopsconsultancy.xmltask.jdk15.XPathAnalyser15 (in unnamed module @0x5c86dbc5) cannot access class com.sun.org.apache.xpath.internal.XPathAPI (in module java.xml) because module java.xml does not export com.sun.org.apache.xpath.internal to unnamed module @0x5c86dbc5
at com.oopsconsultancy.xmltask.jdk15.XPathAnalyser15.analyse(XPathAnalyser15.java:28)....
Version 15 has been archived so, I downloaded it from the idk archive https://jdk.java.net/archive/.
#I decompressed with the tar command:
tar -xvf openjdk-15_osx-x64_bin.tar
# Installed the JDK
sudo mv jdk-15.0.1.jdk /Library/Java/JavaVirtualMachines/
#Verified
/usr/libexec/java_home -V
Matching Java Virtual Machines (1):
15 (x86_64) "Oracle Corporation" - "OpenJDK 15" /Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home
#Made it the default version
export JAVA_HOME=`/usr/libexec/java_home -v 15`
Voila!
No comments:
Post a Comment