How to set the JAVA_HOME path in Debian 10
In this article, we will learn how to install Java JDK on the Debian operating system and then set the JAVA_HOME and PATH variables.
Note : The commands and procedures mentioned in this article are done on Debian 10. The same procedure can be applied in other Linux distributions and on older versions of Debian.
Let's start by installing JDK first.
Install OpenJDK on Debian
First, launch Terminal in the operating system. Go to the Activities tab in the top left corner of the desktop. Then search for the Terminal application by typing the relevant keyword into the search bar. From the result, click the Terminal icon to open.
Now in Terminal, run this command with sudo to install Open JDK.
$ sudo apt install openjdk-8-jdk
When prompted for a password, enter the sudo password.

The system may require confirmation by providing the Y / N option. Press Y
and Enter
to confirm, then the Open JDK installation process will be started on the system.
If you receive this error during installation: 'Package OpenJDK has no installation candidate' , follow the steps below:
1. Edit the sources.list file using the following command in Terminal:
$ sudo nano /etc/apt/sources.list
2. Add the following archive to your sources.list file .
deb http://ftp.de.debian.org/debian sid main
Then press Ctrl
+ O
and Ctrl
+ X
to save and exit the file.
3. Update the repository index with the following command:
$ sudo apt update
4. Then run the installation command as follows:
$ sudo apt install openjdk-8-jdk
Set the path for JAVA_HOME
Find the path to install OpenJDK on the system. Usually, it is usr / lib / jvm / java-8-openjdk-amd64 /. To set the JAVA_HOME environment path, enter the following command in Terminal:
$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
You have now set the JAVA_HOME path and can verify it by running the following command in Terminal:
$ echo $JAVA_HOME
In the output, you will see the value stored in the JAVA_HOME variable as shown in the following screenshot.

Add the JAVA bin directory to the PATH variable
Similar to the JAVA_HOME path, you will now add the $ PATH variable. The $ PATH variable points to the bin directory in the JDK installation directory. Since the JDK directory location has been set using the JAVA_HOME variable, now we only need to use the JAVA_HOME attribute to set the bin directory location.
Enter this command in Terminal to add a Java bin directory to the PATH variable:
$ export PATH=$PATH:$JAVA_HOME/bin
The Java bin directory will be added to the existing PATH variable. To verify it, run the following command in Terminal:
$ echo $PATH
Check the JAVA setting
Now that we've installed OpenJDK and set the variables JAVA_HOME and PATH, it's time to verify the installation. In Terminal, run the following command to do so:
$ java -version

Now, you can easily develop and run JAVA applications on your system.
You should read it
May be interested
- How to Install Debiandebian is an operating system based on the gnu/linux build. the debian operating system, like most other linux distributions, is free and open source. it is a popular operating system for both desktop and server use, spawning several...
- Configure mouse settings on the Debian systemdebian allows you to create as many configurations as possible in the system modules. in this article, tipsmake.com will describe how to configure mouse settings on a debian system.
- Path of Exile 2 PC Configurationpath of exile 2 is the latest title in the popular action role-playing series, especially on pc.
- How to fix the long path of the directory path on Windowslong path fixer will fix path errors too long when accessing, moving, copying. by default, windows api will only support 260 characters.
- How to Install Wireshark on Debian 11wireshark is a free and open source packet analyzer. it allows users to check data from the network directly or from the capture file on the drive.
- How to reset the password for sudo in Debianthe user password is changed in debian using the passwd command. in this article, tipsmake.com will explain how root users can change their own passwords on debian servers.
- How to install Qmmp on Debian 10qmmp is a feature-rich audio player with support for many formats. in this article, tipsmake.com will introduce two ways to install / uninstall qmmp on debian
- How to install Arduino IDE on Debian 10arduino ide (integrated development environment) is open source software used to interact with arduino control boards. using it, you can connect and communicate with the arduino hardware.
- How to install and use PHP Composer on Debian 11php composer is a dependency manager for php. this dependency manager supports application development and the process of calling libraries and frameworks.
- How to upgrade from Debian 11 'Bullseye' to Debian 12 'Bookworm'if you are already using debian 11 bullseye, you can directly upgrade to debian 12 bookworm from the terminal.