echo export 'JAVA_HOME=\$(/usr/libexec/java_home)' > ~/.bash_profileįor the Mac OS 10.6 or above as I mentioned before it is important to add the java home in your bash profile. Once the installation is completed open the terminal window and type the following command. If JDK is not installed, you can download from the Oracle website. To check the Java version on the Mac, open the terminal window (press cmd + space and type terminal), and type java -version in the terminal window, if JDK is properly installed you will get the output something like shown in the image below, Before setting up the variable make sure that JDK is installed on your machine. If you will not set the path it will not work. In MAC OS 10.6 or above you have to set the JAVA_HOME variable in the. Searching multiple websites I find out that after MAC OS 10.5, Apple recommend a different way to set JAVA_HOME variable. And I face little time while installing and setting up JAVA_Home variable on the MAC.