Check your Java installation in Debian and check your installed version (if any)
Java is one of the most common programming languages used to develop and run a wide variety of applications. By default, Linux distributions, including Debian, do not come with java (Java Runtime Environment, JRE) installed. However, sometimes, in order to run certain programs, we may need to find out if java is running on our system or not, as well as which version is currently running.
In this article, we will explore the different ways that you can check if Java is installed on your system along with its version. We used Debian 10 to run the commands and procedures mentioned in this article.
We need a Terminal application to run the procedure. Launch Terminal on your Debian OS. go to the Actions tab in the upper left corner of your desktop. Then, in the search menu that appears, find the Terminal application and launch it.
Get Java version
Enter the following in Terminal to check which Java version is installed.
$ java -version
Or
$ java --version
It will check if the Java Runtime Environment is installed on your system along with the Java version you are using on your system.
If you get output similar to the following figure, then Java is not installed on your system.
If you have Java installed on your system, you will see the following information about the Java OpenJDK and JRE versions:
Check if Java is installed
Another way to check for Java installation is to check the path where Java is installed. To do this, run the following command in Terminal:
$ which java
You will get the following output if you have java installed on your system, otherwise you won’t get any output.
Advertisement
Search Java in the list of installed packages
You can also check any software installation on your system by searching the list of installed packages. The following syntax can be used for this purpose:
$ sudo aptitude search PackageName
To check if any Java package is installed on your system, run the following command in Terminal.
$ sudo aptitude search jdk
The above command will list all JDK packages available in the Debian repositories. The first letter of each line represents the current state of the package, the line starting with the “i” prefix is the one installed on your system.
From our output below, we can see that Java openjdk-11-jdk is installed on our system. If you do not find the “i” prefix, it means that Java is not installed on your system.
Using the dpkg utility to find out which Java package is installed
Dpkg is a command line utility that is used to get a list of installed packages on Linux OS. We can use it to find the Java version installed on your system. To do this, run the following command in Terminal:
$ dpkg --list | grep -i jdk
Using the above methods, you can check if Java is installed on your system or not. Along with this, you can check the version of Java installed.
Check your Java installation in Debian and check your installed version (if any)