Set JAVA_HOME correctly on Mac OS 10.12

Summary

It seems that this should be correct.

#You can get the appropriate path automatically.
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

Until now, it was a full path direct writing. (And the link was broken)

#This is a bad example.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

How to set

If you don't have JDK yet, download it from the Oracle download site and install it.

Open ~ / .bash_profile in an editor and add ```export JAVA_HOME = ... ``.

$ vi ~/.bash_profile

...

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

Reopen Terminal.app or reload ~ / .bash_profile with the following command.

$ source ~/.bash_profile

Make sure you have set it up as you intended.

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

Recommended Posts

Set JAVA_HOME correctly on Mac OS 10.12
Install gradle on mac
Run STS4 on Mac
Note: Memory Analyzer does not work on Mac OS
Install openjdk11 on mac
Install OpenJDK 8 on mac
Until you start nginx on CentOS using Docker on Mac OS
Notes on installing eclipse with Homebrew on Mac OS High Sierra
Set up ansible-playbook on Ubuntu 20.04
Install tomcat + eclipse on mac
Try Spring Boot on Mac