$JAVA_HOME without JDK

Iman Tung
May 16, 2021

--

I try to run a jar file on my user laptop and found that the terminal java version is different from the mac OS version. Downloading JRE is not helping because it’s not set environment variable $JAVA_HOME

This instruction may help to set $JAVA_HOME without downloading JDK.

  1. Go to System Preference > Java

2. Check or update your java version on Update tab

3. On Java tab, click button View to see the java installation location.

4. Copy the path and remove bin/java

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

5. Setup environment variable on your mac

$ echo "export JAVA_HOME=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home" >> ~/.bash_profile
$ source .bash_profile

6. Check your java version

$ java -version

Previously published in https://imantung.github.io at 13 Sep 2017

--

--

Iman Tung
Iman Tung

Written by Iman Tung

Technology to write, life to grateful. Overthinking is good, only if it has the output. Fundamental is the main concern.

No responses yet