Key management
Java Keytool

Configure the JAVA_HOME environment variable

1min

You must correctly configure the JAVA_HOME environment variable to locate the installed JDK (Java Development Kit) on your system and to enable Java applications and tools. This section shows how to set the JAVA_HOME environment variable and update the system PATH variable on both Linux and Windows.

To ensure proper compatibility between Java SunPKCS11 and the PKCS11 module, you must use Oracle Java and not OpenJDK. Oracle Java 11, 17, and 21 are currently supported.

Choose one of the following operating systems and perform the instructions:

Linux
Windows
1

Determine the installation path of Oracle Java:

Find the path for the Oracle Java installation, such as /usr/lib/jvm/. Use the following command to list the installed JDKs:

Shell


For example, if you installed Oracle Java 11, the path is likely: /usr/lib/jvm/jdk-11-oracle-x64.

2

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.

Shell

3

Add the JAVA_HOME and update PATH:

Add the following lines to the end of the /etc/profile file, replacing the path with the actual path to your Oracle Java installation:

Text

4

Apply the changes:

After saving the file, apply the changes by sourcing the profile file:

Shell

5

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:

Shell


You should see the path you set for JAVA_HOME and ensure $JAVA_HOME/bin is part of the PATH.