How To: JAVA_HOME (Mac)
slatzz
Posted on April 10, 2024
Table of Contents
- Check current version
- View all versions on machine
- Download a new version of Java
- Check JAVA_HOME
- Update JAVA_HOME
Check current version
java -version
View all versions on machine
/usr/libexec/java_home -V
Download a new version of Java
Check JAVA_HOME
echo $JAVA_HOME
Update JAVA_HOME
Step one
export JAVA_HOME=`/usr/libexec/java_home -v X.X.X`
// Example
export JAVA_HOME=`/usr/libexec/java_home -v 20.0.02`
Step two
nano ~/.zshrc
/**
* If you don't already have JAVA_HOME defined, add it
* to this file with the path to your desired version of
* Java. Example below:
**/
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home"
Save your changes
CTRL + O (Not zero)
ENTER
CTRL + X
Confirm
// Confirm your file saved
nano ~/.zshrc
// Confirm Java version
java --version
Thank you for reading ππ½ I hope this was helpful. βΊοΈ
π πͺ π
π©
slatzz
Posted on April 10, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
privacy Caught in the Crunch My Journey from Snacks to 2 Million Exposed Users Privacy
November 30, 2024