Following instruction can quickly help to set JAVA_HOME on mac machine :
- Open Terminal
- Type which java it will prompt /usr/bin/java in case JAVA is already installed but if it is not then you have to download from oracle.com.
- Let say JAVA is installed then Type java -version It will prompt below:
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode
- For MAC java home path is /Library/Java/Home or if you have more than one version then it can be /Library/Java/JavaVirtualMachines/jdk-11.0.3.jdk/Contents/Home. In my system java home path was as above since my system has multiple jvm.
- To set JAVA HOME or Correct version of JAVA HOME run following :
or
export JAVA_HOME= /Library/Java/JavaVirtualMachines/jdk-11.0.3.jdk/Contents/Home
- Run echo $JAVA_HOME to check path has been set correctly.
Note that this sets JAVA_HOME only for this session. If need to persist then we need to add this into ~/.profile. Following steps can help :
- Open up Terminal (Applications >> Utilities >> Terminal)
- Type: emacs .profile
- add this to the end of the .profile file:
JAVA_HOME=/Library/Java/Home
or
JAVA_HOME= /Library/Java/JavaVirtualMachines/jdk-11.0.3.jdk/Contents/Home
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode
Now we are all set with JAVA HOME.
Cheers,
Kapil
or
JAVA_HOME= /Library/Java/JavaVirtualMachines/jdk-11.0.3.jdk/Contents/Home
- export JAVA_HOME;
- Save and exit emacs (ctrl-x, ctrl-s; ctrl-x, ctrl-c)
- Open a new Terminal window and type: java -version.
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode
Now we are all set with JAVA HOME.
Cheers,
Kapil
No comments:
Post a Comment
Thanks for your comment, will revert as soon as we read it.