Specifying a different Java location for your application

Learn how to specify a different Java™ location for your application.

About this task

If your default environment does not point to the correct JRE, add the directory that contains the Java binary to the PATH environment variable in the Service section of the application profile. This adds the directory you specify to the beginning of your existing PATH environment variable.

In cases where you cannot guarantee that the PATH environment variable on a compute host:

  • Includes a Java bin directory
  • Has the path to the Java bin directory for the Java version you want to use

You can configure your System PATH to point to the correct Java version, or set the path to the correct version of Java in the application profile.

Note: If you change the configuration of your system path environment, you must restart IBM® Spectrum Symphony or IBM Spectrum Symphony Developer Edition.

If you set it in your application profile, the directory you specify is added to the beginning of your existing PATH environment variable.

Note: If you set the Java bin path in your application profile, all compute hosts must have Java installed in the same location. If Java is not installed at that location, the system uses the next Java location in the Path, if any.

Procedure

  1. Open the application profile for your application.

    For example, on Linux®, under IBM Spectrum Symphony Developer Edition:

    $SOAM_HOME/version/samples/Java/SampleApp/SampleAppJava.xml

    For example, on Windows, under IBM Spectrum Symphony Developer Edition:

    %SOAM_HOME%\version\samples\Java\SampleApp\SampleAppJava.xml

  2. In the Service, osTypes, osType section, change the PATH environment variable to point to the correct Java version. For example:
    <Service description="The Sample Service" name="sampleService">
            <osTypes>
              <osType name="X86_64" startCmd="${SOAM_DEPLOY_DIR}/Runcom.platform.symphony.samples.SampleApp.service.MyService.sh" workDir="${SOAM_HOME}/work">
      <env name="PATH">/usr/bin/jdk1.8.0_131/bin</env>
             </osType>
              <osType name="NTX64" startCmd="cmd.exe /c cmd.exe /c ${SOAM_DEPLOY_DIR}/Runcom.platform.symphony.samples.SampleApp.service.MyService.bat" workDir="${SOAM_HOME}/work".>
      <env name="PATH">c:\java\jdk1.8.0_131\bin</env>
             </osType>
            </osTypes>
    </Service>
    
  3. Save the file.
  4. Update your application profile with the cluster management console or the soamreg command.

    For example, on Linux:

    soamreg $SOAM_HOME/version/samples/Java/SampleApp/SampleAppJava.xml

    For example, on Windows:

    soamreg %SOAM_HOME%\version\samples\Java\SampleApp\SampleAppJava.xml