Configure JAVA_HOME via command under linux - tutorial - 2021

Last updated November 1, 2022 at 11:06 AM

Under linux , you will need to configure the JAVA_HOME to use your java applications with your new jdk. How to do it ?


It may happen that under linux , you want to use the newly installed jdk which may be different from the openjdk (alternative open source of java jdk) that we know. Sometimes you are also sure that you have installed java in your linux but no java application can start without you specifying a jdk.

To automate all this we go to this tutorial associate the path of your jdk with the JAVA_HOME environment variable.


ReadInteractive map of the linux kernel - Software


[bctt tweet=”JAVA_HOME – How to configure it via command under linux – tutorial” username=”tedidevblog”]




Solution to configure the JAVA_HOME


To add your jdk to the environment variable of your system, you must open your terminal and run the following command:


export JAVA_HOME =path_to_your_jdk


You can check if your command is correctly executed by running this:

echo $ JAVA_HOME


You will see the path_to_your_jdk as a response to this command. This solution is one of the little things that we often forget about IT because we only use it once for a long time. Fortunately, the Internet is there to remind us.


Lire aussi.gitignore does not work - the file is not taken into account - Troubleshooting


Last updated November 1, 2022 at 11:06 AM





You may be interested in Snap - How to install it from the terminal in ubuntu - tutorial et Ninja Gaiden Master Collection - Announcement Trailer - PS4


JAVA_HOME - How to configure it via command under linux - tutorial
Image by Rudy and Peter Skitterians from Pixabay