Troubleshooting Java

Important

This documentation is based on OSX, Windows version coming later..

Check current JDK version

To see all installed JDK’s on you environment, if any, type the following command in your terminal:

~/ $ /usr/libexec/java_home -V
Matching Java Virtual Machines (4):
    1.8.0_45, x86_64:  "Java SE 8"     /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
    1.8.0_40, x86_64:  "Java SE 8"     /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
    1.8.0_20, x86_64:  "Java SE 8"     /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home
    1.7.0_67, x86_64:  "Java SE 7"     /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
~/ $

Enonic XP run on Java 8 only, using update 92 or later. If you have a Java 8 JDK equal to or above version 1.8.0_92, but the javac -version points to another version, proceed to set the JAVA_HOME environment variable correctly.

Setting JAVA_HOME

If you don’t have a Java 8 JDK equal to or above version 1.8.0_92, you must install a newer version.

  • Go to the JDK page and look down the page for the Java 8 section. The download button for the JDK, will download the latest version for Java 8.
  • Follow the installation instructions.
  • After installation, proceed to check that the JAVA_HOME environment variable is set correctly.

To check the current JAVA_HOME environment variable:

~/ $ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
~/ $

If this is not set correctly, you must set the correct one either for this terminal session, or in your .profile or .bashrc for all terminal sessions.

  • To set the correct JAVA_HOME for the current terminal session; invoke the following command in your terminal. This command will set JAVA_HOME to the newest installed 1.8 JDK-version:
~/ $ export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
  • To set for all terminal sessions, add the entry to either your ~/.bash_profile or ~/.profile.
$ vim .bash_profile

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

$ source .bash_profile

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/1.8.0_131.jdk/Contents/Home