Skip to main content
You must correctly configure the JAVA_HOME and PATH environment variables 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 Linux.
This integration works with either Oracle Java or OpenJDK. Use JDK version 11, 17, or 21.

Linux

Perform the following steps to configure the JAVA_HOME variable in Linux:
1
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
For example, if you installed 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 Java installation:
None
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.