

With macOS Monterey, v12.0.1 Cask is no longer a Brew command. Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode) Java(TM) SE Runtime Environment (build 1.8.0_102-b14) I can switch to Java 8 by typing the following: $ j8 zshrc for MacOS 10.15+) which makes it really convenient to switch (including comment for java 9): alias j20="export JAVA_HOME=`/usr/libexec/java_home -v 20` java -version"Īlias j19="export JAVA_HOME=`/usr/libexec/java_home -v 19` java -version"Īlias j18="export JAVA_HOME=`/usr/libexec/java_home -v 18` java -version"Īlias j17="export JAVA_HOME=`/usr/libexec/java_home -v 17` java -version"Īlias j16="export JAVA_HOME=`/usr/libexec/java_home -v 16` java -version"Īlias j15="export JAVA_HOME=`/usr/libexec/java_home -v 15` java -version"Īlias j14="export JAVA_HOME=`/usr/libexec/java_home -v 14` java -version"Īlias j13="export JAVA_HOME=`/usr/libexec/java_home -v 13` java -version"Īlias j12="export JAVA_HOME=`/usr/libexec/java_home -v 12` java -version"Īlias j11="export JAVA_HOME=`/usr/libexec/java_home -v 11` java -version"Īlias j10="export JAVA_HOME=`/usr/libexec/java_home -v 10` java -version"Īlias j9="export JAVA_HOME=`/usr/libexec/java_home -v 9` java -version"Īlias j8="export JAVA_HOME=`/usr/libexec/java_home -v 1.8` java -version"Īlias j7="export JAVA_HOME=`/usr/libexec/java_home -v 1.7` java -version"Īfter inserting, execute $ source. Same for jenv, it's cool and all, but as far as I can tell it merely changes environment variables, so it has the same limitation.Īdding to the above answers, I put the following lines in my. It won't affect an application started from OS launcher (unless you change the right file and logout/login, which is tedious).
Will default folder x work with mac high sierra how to#
Many explain how to change $JAVA_HOME, but this only affects the current shell and what is launched from there.

(*) Current answers are either obsolete (no longer valid for macOS El Capitan or Sierra), or only address a single JDK, or do not address the system-wide aspect. When working in a shell with alternate JDK, pick your method among existing answers ( jenv, or custom aliases/scripts around /usr/libexec/java_home, etc). System launcher will use the JDK with highest version among those that have an ist file. It will simply be ignored by system's java command. That JDK can still be used when $JAVA_HOME points to it, or explicitly referenced in a script or configuration.
