Setting JAVA_HOME PATH on MAC

  1. Open Terminal
  2. Confirm you have JDK by typing “which java”. It should show something like /usr/bin/java.
  3. 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/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
  4. Set JAVA_HOME using this command in Terminal:
    • export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.
      jdk/Contents/Home
    • export PATH=$PATH:$JAVA_HOME
  5. Lastly apply these changes by re-sourcing .bash_profile:
    • source ~/.bash_profile
  6. To verify if the PATH is set right :
    1. Open Terminal and Type : $JAVA_HOME/bin/java -version
    2. Should give output something as below :

java version “1.8.0_112”
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)
Abc-MacBook-Pro:~ Abc$ java version “1.8.0_112”

Published by C. A. Stubborn-Pen

Frustrated Independent Self Sufficient Woman

One thought on “Setting JAVA_HOME PATH on MAC

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.