> ## Documentation Index
> Fetch the complete documentation index at: https://docs.futurex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure the JAVA_HOME environment variable

> Procedural guide to set JAVA_HOME and update PATH on Linux and Windows.

JSign runs on the Java platform, so you must correctly configure the **JAVA\_HOME** environment variable to locate the installed **JDK (Java Development Kit)** on your system. This also makes the `java` and `keytool` commands this guide uses available on your **PATH**. This section shows how to set the **JAVA\_HOME** environment variable and update the system **PATH** variable on both **Linux** and **Windows**.

<Note>
  This integration works with either Oracle Java or OpenJDK. Use JDK version 11, 17, or 21.
</Note>

<Tip>
  Many Linux distributions put `java` and `keytool` on the **PATH** when you install a JDK from the package manager, and the commands in this guide then work with **JAVA\_HOME** unset. Run `java -version` and `keytool -help` first. If both commands run, skip this section.
</Tip>

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

## Linux

Perform the following steps to configure the **JAVA\_HOME** variable in Linux:

<Steps>
  <Step>
    **Determine the installation path of Java**

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

    ```shell expandable lines wrap title="Shell" theme={null}
    ls /usr/lib/jvm/
    ```

    For example, if you installed Java 21, the path is likely: `/usr/lib/jvm/java-21-openjdk-amd64`.
  </Step>

  <Step>
    **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 expandable lines wrap title="Shell" theme={null}
    sudo nano /etc/profile
    ```
  </Step>

  <Step>
    **Add the JAVA\_HOME environment variable and update PATH**

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

    ```none expandable lines wrap title="None" theme={null}
    export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
    export PATH=$JAVA_HOME/bin:$PATH
    ```
  </Step>

  <Step>
    **Apply the changes**

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

    ```shell expandable lines wrap title="Shell" theme={null}
    source /etc/profile
    ```
  </Step>

  <Step>
    **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 expandable lines wrap title="Shell" theme={null}
    echo $JAVA_HOME
    echo $PATH
    ```

    <Check>
      You should see the path you set for JAVA\_HOME and ensure `$JAVA_HOME/bin` is part of the PATH.
    </Check>
  </Step>
</Steps>

## Windows

Perform the following steps to configure the **JAVA\_HOME** variable in Windows:

<Steps>
  <Step>
    **Determine the installation path of Java**

    Ensure **Java** is installed on your system. Note the installation path, typically something like `C:\Program Files\Java\jdk-21`.
  </Step>

  <Step>
    **Open System Properties**

    Select the **Win + Pause/Break** keys to open the **System Properties** window, or right-click **This PC**(or **My Computer**) and select **Properties**.

    Select **Advanced system settings** on the left sidebar.
  </Step>

  <Step>
    **Open Environment Variables**

    In the **System Properties** window, select **\[ Environment Variables ]** near the bottom of the window.
  </Step>

  <Step>
    **Create a new system variable**

    In the **Environment Variables** window, in the **System variables** section, select **\[ New ]**.

    In the **New System Variable** dialog box, enter the following:

    * Variable name: **JAVA\_HOME**
    * Variable value: The path to your JDK installation (such as `C:\Program Files\Java\jdk-21`)
  </Step>

  <Step>
    **Update the PATH variable**

    In the **System variables** section, find and select the **Path** variable, then select **\[ Edit ]**.

    In the **Edit Environment Variable** dialog, select **\[ New ]** and add `%JAVA_HOME%\bin` to the list. This enables the system to find the Java executables.
  </Step>

  <Step>
    **Create an additional system variable**

    * Variable name: **FXPKCS11\_CFG**
    * Variable value: The path to your FXPKCS11 configuration file (such as `C:\Program Files\Futurex\fxpkcs11\fxpkcs11.cfg`)

    <Note>
      **FXPKCS11\_CFG** points at the Futurex library configuration file (`fxpkcs11.cfg`), not at the SunPKCS11 provider configuration file (`pkcs11.cfg`) you create in the next section. If you left `fxpkcs11.cfg` in its default location of `C:\Program Files\Futurex\fxpkcs11`, this variable is optional.
    </Note>
  </Step>

  <Step>
    **Apply changes**

    Select **\[ OK ]** on each dialog box to apply the changes and exit the dialog boxes.
  </Step>

  <Step>
    **Verify the configuration**

    Open a new Command Prompt window (select the **Win + R** keys,  enter **cmd**, and press the **Enter** key).

    * Enter `echo %JAVA_HOME%`. You should see the path to your JDK installation.
    * Enter `java -version` to confirm that the system recognizes the Java installation.
  </Step>
</Steps>
