Java on OS X

Sometimes your Mac has a very old version of Java on it, like 1.6.0_123. This can break running the LANforge client. Let’s learn how to manage this. First, open Terminal and find what version of Java you think you have:

$ java -version

This reports what your JAVA_HOME environment variable (which might not be set) is, so the System will do a /usr/libexec/java_home command for you. You might need to follow these instructions on removing old Java version.

Install a recent version of Java. Then go back to the terminal. You want to make sure that your JAVA_HOME variable is getting set to the version you want. Verify you have a .profile and a .bashrc file in your home directory:

$ ls -l ~/.profile ~/.bashrc

Create them if the don’t exist:

$ touch ~/.profile ~/.bashrc
$ chmod 700 ~/.profile ~/.bashrc
$ echo "source .bashrc" >> ~/.profile

To see the versions of Java installed, use the java_home command:

$ /usr/libexec/java_home -V

The first column of output will be the version number, which is important for running the java_home command. Edit your .bashrc file to export your JAVA_HOME environment variable:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0_122)

Save and open a new terminal. Verify using java -version.

More discussion on setting the version: