6.1. Java

6.1.1. Install Java

Go to https://java.com/en/download/linux_manual.jsp web site and download JRE tarball based on your processor architecture (32-bit or 64-bit).

_images/troubleshooting-java-01.png

You should have downloaded jre-8u101-linux-i586.tar.gz or jre-8u101-linux-x64.tar.gz file (update version can be different, here u101). Copy one of these files to you mail server.

Unpack the tarball:

tar zxvf jre-8u101-linux-x64.tar.gz

Move extracted files to /opt directory (as root):

mv jre1.8.0_101 /opt

Change owner of the /opt/jre1.8.0_101 directory:

chown -R root:root /opt/jre1.8.0_101

Create symbolic link for easier use:

ln -s /opt/jre1.8.0_101/ /opt/jre

Check if Java is correctly installed:

/opt/jre/java/bin -version

Example result:

openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-build_2014_07_29_16_56-b00)
OpenJDK 64-Bit Server VM (build 25.40-b01, mixed mode)

6.1.2. JAVA_HOME environment variable not found

When you receive this error while installing:

* Checking permissions...done.

>> Error: JAVA_HOME not found in your environment (user root).
>> Please, set the JAVA_HOME variable in your environment to match the
>> location of the Java Virtual Machine you want to use.

>> If you are using sudo, run with -E option.

You need to set properly JAVA_HOME environment variable.

6.1.2.1. /opt/jre directory

If you just did install Java with Install Java then your JRE is located in /opt/jre directory, so just invoke:

export JAVA_HOME="/opt/jre"

And your JAVA_HOME environment variable is set up. To confirm that invoke command:

$JAVA_HOME/bin/java -version

You will recieve a Java version output.

6.1.2.2. Other Java installation directory

By default Java installation directory can be anywhere, so you need to look for it. Use command:

find / -name java

You should get results like this (with default Zimbra installation):

/opt/zimbra/java
/opt/zimbra/j2sdk-20140721/bin/java
/opt/zimbra/j2sdk-20140721/jre/bin/java
/etc/pki/java
/etc/pki/ca-trust/extracted/java

Try the first result and invoke Java with version parameter, add /bin/java at the end of found path:

/opt/zimbra/java/bin/java -version

If you will see version of your Java then this is the correct path. If not try another one.

When you have a valid path set $JAVA_HOME variable (without appeding /bin/java):

export JAVA_HOME="/opt/zimbra/java"

To check if variable is correctly set, invoke once again java with version parameter, but now using $JAVA_HOME variable (don’t forget to add /bin/java at the end):

$JAVA_HOME/bin/java -version

And the result:

openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-build_2014_07_29_16_56-b00)
OpenJDK 64-Bit Server VM (build 25.40-b01, mixed mode)

Note

JAVA_HOME variable will be set only for current session, so when you will logout it will be lost. To preserve variable edit /etc/environment file and add export JAVA_HOME=”/opt/zimbra/java” line at the end of the file.