How to Set up an Environment variable for JAVA in Latest Mac Os
Jan 5, 2021
Please use the below commands If you are using the latest versions of macOS.
Problem Statement
We cannot use ~/.bash_profile to export your environment variable since the bash shell is deprecated in the latest version of macOS.
Solution
Run the below command on Terminal and you ready to use JAVA
1.Run /usr/libexec/java_home in your terminal and you will get things like /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
2.Run in terminal export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home