• Open Terminal
• Confirm you have JDK by typing “which java”. It should show something like /usr/bin/java.
• Check you have the needed version of Java, by typing “java -version”.
◦ JAVA_HOME is essentially the full path of the directory that contains a sub-directory named bin which in turn contains the java.
◦ For Mac OSX – it is /Library/Java/Home
• Set JAVA_HOME using this command in Terminal:
export JAVA_HOME=/Library/Java/Home
•
echo $JAVA_HOME on Terminal to confirm the path
• You should now be able to run your application
Note that this sets JAVA_HOME only for this session. If you want it to persist, you will have to add the command to your
~/.profile file. Below are instructions on how to accomplish this instead:
• Open up
Terminal.app (Applications >> Utilities >> Terminal)
• Type:
emacs .profile
• add this to the end of the .profile file:
JAVA_HOME=/Library/Java/Home
export JAVA_HOME;
• Save and exit emacs (ctrl-x, ctrl-s; ctrl-x, ctrl-c)
• Open a new Terminal window (cmd-n) and type:
$JAVA_HOME/bin/java -version