Set the JAVA_HOME variable for Liberty collective members and controllers
All Liberty collective members must have a Java Runtime Environment (JRE) installed that meets the minimum requirements of the Liberty server. After a JRE is installed on the host computer, we can set the JAVA_HOME variable so that the Liberty operation can locate the JRE.
In order for the collective controller to perform remote operations on Windows members such as starting or stopping a member server, the collective controller must run with an IBM JRE. Third-party JREs do not contain the required security classes. We can get a JRE that supports Liberty products and SSL from Installation Manager offerings or developerWorks:
- Use Installation Manager, select the Liberty product first and then select the IBM SDK for Liberty. Use Installation Manager to install the Liberty product and software development kit (SDK). The IBM SDK includes the needed support for Liberty products and SSL and offers a Java client, JConsole. For more information about installing the IBM SDK, see the following topics.
- From the developerWorks website download an IBM Java development kit (JDK) for the operating system. For Windows operating systems, get the JDK from Eclipse.
Setting the JAVA_HOME variable enables remote operations to locate the JRE.
Set JAVA_HOME on a UNIX system
Rather than change the operating system settings, we can set JAVA_HOME at a command line by entering set JAVA_HOME=path_to_jre. A limitation is that the JAVA_HOME setting applies to commands entered in the same command window only.
If we are running bash shell, we can add the JAVA_HOME environment variable to the .bashrc file in the user's home directory.
One option for setting JAVA_HOME is to create a server.env file in the ${server.config.dir} where server.xml file is, and add JAVA_HOME there:
- JAVA_HOME=/java/jre
Note that the server.env file must be in EBCDIC.
Some collective controller commands require that the path to the Java installation jre/bin directory is available in the .bashrc file, so set a path to jre/bin in the .bashrc file.
Set JAVA_HOME on a Windows system
- On the Control panel:
- Click System.
- Click Advanced system settings.
The System Properties window opens.
- Click the Environment Variables button.
- Click the New button in the system-variables section.
- Add the JAVA_HOME variable name and specify a path to the jre directory. For example:
-
C:\wlp_16002\IBM\WebSphere\Liberty\java\java_1.8_64\jre
Some collective controller commands require that the path to the Java installation jre\bin directory is available in the System path, so also add a path to the jre\bin directory.
- Save the changes. We might need to restart the computer for the changes to take effect.
- To verify the changes, at a command line enter set JAVA_HOME. The command displays the JAVA_HOME settings:
- JAVA_HOME=C:\wlp_16002\IBM\WebSphere\Liberty\java\java_1.8_64\jre