Setting the JAVA_HOME environment variable

After installing the OpenJDK, you must set $JAVA_HOME for the root user.

  1. Log in to the Analytics server as root, or as a user with superuser privileges and check that the variable is not currently set:
    echo $JAVA_HOME
  2. Locate and note the path to your OpenJDK directory. Typically, this is /usr/lib/jvm/java-1.7.0-openjdk-<version>.
    ls -l /usr/lib/jvm/java-1.7.0-openjdk-<version>
  3. Navigate to the /etc/default directory.
    cd /etc/default
  4. Open a new zenoss_analytics file in an editor.
    vi zenoss_analytics
  5. Edit the JAVA_HOME line in zenoss_analytics to point to your OpenJDK location and save the file. The resulting entry will look like this:
  6. Source this file:
    source zenoss_analytics
  7. Test the new setting of the JAVA_HOME variable:
    echo $JAVA_HOME