Configure environment variables for Apache Tomcat
You must correctly configure the JAVA_HOME environment variable to enable Java applications and tools to locate the installed JDK (Java Development Kit) on your system. Apache Tomcat also requires the CATALINA_HOME environment variable to point to the directory where Tomcat is installed. This section shows how to set the JAVA_HOME and CATALINA_HOME environment variables and update the system PATH variable on Linux and Windows operating systems.
To ensure proper compatibility between Java SunPKCS11 and the Futurex PKCS11 module, you must use Oracle Java and not OpenJDK. Oracle Java 11, 17, and 21 are currently supported.
Select your operating system and perform the instructions:
Determine the installation path of Oracle Java:
Find the path where Oracle Java is installed, such as /usr/lib/jvm/. Use the following command to list the installed JDKs:
For example, if you installed Oracle Java 11, the path is likely /usr/lib/jvm/java-11-openjdk-amd64.
Determine the installation path of Tomcat:
You can use the find command to locate the Tomcat installation directory:
The catalina.sh script is located in the bin directory of the Tomcat installation. The directory containing catalina.sh is the CATALINA_HOME.
Edit the profile file:
Open a terminal and use a text editor to edit the /etc/profile file, which the system uses when users log in. You might need superuser privileges to edit this file.
Add the Environment Variables and Update PATH:
Add the following lines to the end of the /etc/profile file, replacing the paths with your actual installation paths:
Apply the changes:
After saving the file, apply the changes by sourcing the profile file:
Verify the configuration:
To ensure that the JAVA_HOME variable is set correctly and the PATH is updated, you can check their values with the following commands:
You should see the individual paths set for JAVA_HOME and CATALINA_HOME, as well as their inclusion in the PATH.