Setting Java variables in Linux

JAVA_HOME and PATH are variables to enable your operating system to find required Java programs and utilities.

Before you begin

Ensure the required Java version is installed on all nodes in your topology.
Important: If Java is not installed on your install system, refer to the appropriate documentation to install Java before setting JAVA_HOME and PATH. For example, to install IBM JDK (Windows or Linux), see the Knowledge Center for IBM JDK.

About this task

To set Java variables in Linux:
Attention: When you add the bin directory for the IBM JDK to the PATH environment variable, ensure that you add it before any other directory currently listed in the PATH value that might have a Java executable. Also, if the directory that you are adding to the PATH or setting as JAVA_HOME has a space in the path, either contain the path in quotes or escape the space by preceding the path with \.

Procedure

  1. Download or save the appropriate JDK version for Linux.
    Important: You can download the JDK from Passport Advantage or Fix Central or save it from the disk.
  2. Extract the compressed file to the required location.
  3. Set JAVA_HOME using the syntax export JAVA_HOME=path to JDK. For example, export JAVA_HOME= /usr/java/jdk1.7.0_05/.
  4. Set PATH using the syntax export PATH=${PATH}:path to the JDK bin. For example, export PATH=${PATH}:/usr/java/jdk1.7.0_05/bin
  5. Verify the settings using the following commands:

    echo $JAVA_HOME

    echo $PATH

    The output must display the JAVA_HOME and PATH that you set.