> ## 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.

# Configuring the JAVA_HOME environment variable

> Step-by-step instructions to set JAVA_HOME and update PATH on Linux and Windows for JDK access.

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**.

> [!WARNING]
>
> 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.

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

## Linux

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

**Step 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 expandable lines wrap title="Shell" theme={null}
ls /usr/lib/jvm/
```

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

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

**Step 3**

**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 Oracle Java installation:

```none expandable lines wrap title="None" theme={null}
export JAVA_HOME=/usr/lib/jvm/jdk-11-oracle-x64
export PATH=$JAVA_HOME/bin:$PATH
```

**Step 4**

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

> [!TIP]
>
> You should see the path you set for JAVA\HOME and ensure `$JAVAHOME/bin` is part of the PATH.

## Windows

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

**Step 1**

**Determine the installation path of Oracle Java**

Ensure **Oracle Java** is installed on your system. Note the installation path, typically something like `C:\Program Files\Java\jdk-11`.

**Step 2**

**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 3**

**Open Environment Variables**

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

**Step 4**

**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-11`)

**Step 5**

**Update the PATH variable**

In the **System variables** section, find and select the **Path** variable, then seelct **\[ 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 6**

**Create additional system variables**

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

**Step 7**

**Apply changes**

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

**Step 8**

**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.
