Skip to content

Instantly share code, notes, and snippets.

@morikawa77
Forked from tommysdk/select_java_version
Created August 7, 2024 03:07
Show Gist options
  • Save morikawa77/fe88e3b4351e963494a1d7d39b032d7d to your computer and use it in GitHub Desktop.
Save morikawa77/fe88e3b4351e963494a1d7d39b032d7d to your computer and use it in GitHub Desktop.
Change default Java version on Mac OS X using Fish shell
# Based on https://stackoverflow.com/a/26252993/1665539
# Show all installed Java versions
/usr/libexec/java_home -V
# Select major version (if unique, otherwise specify full name e.g. 1.8.0_131)
set -x JAVA_HOME (/usr/libexec/java_home -v 1.8)
# Verify
java -version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment