

The AdoptOpenJDK repository offers a function you can use in ~/.bashrc or ~/.zshrc: You can specify the major version only: export JAVA_HOME=$(/usr/libexec/java_home -v "1.8") Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home You need to unset JAVA_HOME variable before you can set a new value for JAVA_HOME: $ unset JAVA_HOME

However, setting the JAVA_HOME variable does not work this way in macOS BigSur (version 11): $ export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_275` $ echo $JAVA_HOMEĬhanging the java version in macOS prior to version 11 would be: export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_275` The JAVA_HOME variable is set to java version 15 after executing the brew install commands above. Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home The brew commands above result in these installed java versions: # Please note the upper case -V flag.ġ5.0.1 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 15" /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Homeġ4.0.2 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 14" /Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Homeġ1.0.9.1 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Homeġ.8.0_275 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home One option to install java on mac is AdoptOpenJDK with homebrew: brew install -cask adoptopenjdk

with ` brew install -cask adoptopenjdk8/11/14/15`Įxport JAVA_HOME=$(/usr/libexec/java_home -v "$1") In a nutshell # assuming versions below are installed
#APPLE JAVA OSX HOW TO#
This one is about how to change and persist the java version on macOS 11 BigSur in a shell script. Jobs knew full well that Apple was developing its own version of Java, just like all the other platform providers.Setting the java version on BigSur macOS 11 changed compare to setting the java version on earlier macOS versions.

#APPLE JAVA OSX FOR MAC OS#
Java 1.0 for Mac OS 9 was released in 1996, the year Apple bought NeXT and Jobs returned to the Apple fold. With a few notable exceptions, Java's owner has never supplied versions "for all other platforms." Back when Java started, Sun supplied a version of the runtime for Linux because, as the "father of Java" James Gosling says, "there was no one else to do it." Every other distributor - Microsoft, IBM, Hewlett-Packard, and Apple - rolled its own version, based on Sun's reference code. Of course, Jobs knew at the time he was blowing smoke - or perhaps a reality distortion field set in. They have their own release schedules, which are almost always different than ours, so the Java we ship is always a version behind. 21, 2010, the MacRumors forum said that Jobs replied to a concerned Java developer, claiming, "Sun (now Oracle) supplies Java for all other platforms. Apple had never supported Java clients in its iOS. Developers should not rely on the Apple-supplied Java runtime being present in future versions of Mac OS X." At the same time, Apple stopped accepting apps for the Mac App Store that relied on the Java Runtime Environment.
#APPLE JAVA OSX MAC OS X#
20, says, "The Java runtime ported by Apple and that ships with Mac OS X is deprecated. The Mac OS X Developer Library post for Oct. Steve Jobs dropped Java for the Mac in October 2010, removing it as part of the standard OS X install.
