Paths and Environment Settings for the JDK Software

Ensure that your JDK configuration settings on all local and remote GlassFish Server hosts adhere to the guidelines listed below. Failure to adhere to these guidelines can cause various problems that may be difficult to trace.

The following topics are addressed here:

Use the Correct Java Version

Ensure that the version of Java used on all local and remote GlassFish Server hosts meets the requirements specified in Supported Platforms, JDK Versions, Browsers, mod_jk, and JDBC Drivers and Databases.

Use the JDK Binaries

The following binary files that are used with GlassFish Server must come from the JDK software, not the Java Runtime Environment (JRE) software:

To meet this requirement, ensure that the bin directory for the JDK software precedes the bin directory for the JRE software in your path.

Set the JAVA_HOME Environment Variable

Before performing any GlassFish Server installation or configuration procedures, set the JAVA_HOME environment variable on the GlassFish Server host machine to point to the correct Java version. Also be sure to add the JAVA_HOME/bin directory to the PATH variable for your environment. The JAVA_HOME variable must be set on all local and remote GlassFish Server hosts.

Set Other Environment Variables As Necessary

All remote asadmin subcommands require the correct version of Java to be available on the affected remote machine. For example, when creating a cluster or server instance on a remote machine, the remote machine uses its local default Java installation, not the Java installation that is on the DAS. Errors will therefore occur if the remote machine uses the wrong Java version.

Depending on the remote subcommand, the errors may not occur when the subcommand is executed, but may occur later, when interacting with a configuration or resource created or modified by the subcommand. For example, when creating a clustered server instance on a remote machine, the error may only first appear when you attempt to deploy an application on that server instance.

This issue is more likely to be encountered when GlassFish Server is installed on the remote server by means of a ZIP file package rather than a self-extracting installer run in GUI mode. This is because the GUI installer gives you the option to specifically choose your Java version, whereas you do not have that option when simply unzipping a ZIP file.

Depending on what shell is invoked via SSH on the remote host, the JAVA_HOME and PATH environment variables may need to be explicitly set in .bashrc, .cshrc, or some other shell configuration file. This configuration file may differ from the one that is used when you log in to the machine, such as .profile.

Alternatively, you can specifically set the Java path with the AS_JAVA property in the in the as-install-parent/glassfish/config/asenv.conf file.