- How to Check Java Version Installed on Linux
- Method 1: Check the Java Version On Linux
- Method 2: Find Version by Checking Path Where Java is Installed
- Method 3: Search for Java in the Installed Packages List
- Как проверить версию Java
- Управление версиями Java
- Проверка версии Java
- Выводы
- How to check Java Version on Linux Ubuntu
- Understanding the Java Version
- Checking Your Java Version
- Installing Java Using the Browser
- Some Important Commands
- Remove Java Versions
- Should You Use JRE or JDK?
- When to Use JDK
- When to Use JRE
- Some Applications of Java
- Conclusion
- About the author
- Zeeman Memon
- Which java version command linux
- Steps to Verify Java version on windows using Java control panel
- Steps to check Java version on windows using Command prompt
- Steps to check Java version on windows using start menu
- Steps to check Java version on Linux using Java control panel
- Steps to check Java version on Linux using terminal
- Steps to check Java version on Mac using Java control panel
- Steps to check Java version on Mac using terminal
- Steps to check Java version online
- Where Java is installed?
- How to switch Java version
- Java version history
- OpenJDKs list with download links
- What is Java Auto Update? How do I change notify settings?
- Change Automatic Java Update Settings
- Change the Java Update Schedule
- Change the Notification Options
- Manual Update Option
- Conclusion
How to Check Java Version Installed on Linux
Home » SysAdmin » How to Check Java Version Installed on Linux
How do I check my current Java version? There are several ways to check if Java is installed and which version is running on your system.
In this tutorial, learn how to check the Java version installed on Linux distros, including Ubuntu, CentOS, and Debian.
- A user account with sudo privileges
- Access to the command-line/terminal window
- A version of Java
Method 1: Check the Java Version On Linux
To check the Java version on Linux Ubuntu/Debian/CentOS:
1. Open a terminal window.
2. Run the following command:
3. The output should display the version of the Java package installed on your system. In the example below, OpenJDK version 11 is installed.
Note: If the output indicates there is no such package on the system, you can install it with the help of one of our guides – How to install Java on Ubuntu or How to Install Java on CentOS.
You can also check the version of the primary Java compiler – javac (pronounced “java-see”) with the command:
Method 2: Find Version by Checking Path Where Java is Installed
There are two ways to find the path of the Java directory.
The first option includes running a single command:
The system should respond with the path where Java is installed.
Note: This option may not work on CentOS systems. If you have issues finding the path of the Java directory with the command above, use the alternative outlined below.
Alternatively, you can use the whereis command and follow the symbolic links to find the Java path.
1. Run the command:
The output tells you that Java is located in /usr/bin/java.
2. List the content of the /usr/bin/java directory:
Inspecting the directory shows that /usr/bin/java is only a symbolic link for /etc/alternatives/java.
3. Just like in the previous step, list the content of the provided path by running:
Finally, the output displays /etc/alternatives/java is another symbolic link and that the real path of the Java directory is /usr/lib/jvm/java-11-openjdk-amd64/bin/java.
Method 3: Search for Java in the Installed Packages List
You can also prompt the system to list installed packages and search for Java, with its version number.
Find Java by listing all installed packages.
1. To generate a list of all installed packages, use the command:
2. Scroll up/down until you find the Java packages as shown in this example.
To avoid searching through all installed packages, list Java packages only. Prompt the system to list a specific software package. In this case, the package name is openjdk:
Note: CentOS users need to modify the commands for listing installed packages for their package manager. Use the commands: sudo yum list installed and sudo yum list installed | grep -i openjdk instead.
With this article, you have successfully checked the Java version installed on Linux. We also covered checking the Java path and searching for Java among the installed packages.
Once the Java version is confirmed, you can start developing anything from lightweight mobile to desktop applications.
Как проверить версию Java
Java — один из самых популярных языков программирования в мире, используемый для создания различных типов кроссплатформенных приложений.
В этой статье объясняется, как с помощью командной строки проверить, какая версия Java установлена в вашей системе Linux. Это может быть полезно при установке приложений, требующих определенной версии Java.
Управление версиями Java
Java использует семантическое управление версиями . Версии готовых к выпуску релизов представлены по следующей схеме:
Например, в Java 11.0.8 11 — это основная версия, 0 — дополнительная версия, а 8 — версия безопасности.
- MAJOR — Основные выпуски содержат новые возможности и функции.
- MINOR — второстепенные выпуски содержат различные исправления ошибок и совместимые улучшения.
- SECURITY — выпуски безопасности содержат критические исправления безопасности.
Проверка версии Java
Чтобы узнать, какая версия Java установлена в вашей системе, выполните команду java -version :
Команда отобразит версию Java по умолчанию:
В этом примере в нашей системе установлена Java версии 11.0.8 . Версия, установленная в вашей системе, может отличаться.
Если вы получили сообщение «java: command not found», это означает, что Java не установлена в системе. Чтобы установить Java, воспользуйтесь одним из следующих руководств в зависимости от вашего дистрибутива Linux:
В системе также может быть установлено несколько версий Java одновременно. Чтобы проверить, есть ли на вашем компьютере несколько установок Java:
Если у вас только одна установка Java, результат будет выглядеть примерно так:
В противном случае, если у вас несколько установок Java, команда отобразит меню, в котором вы можете выбрать, какая версия будет версией Java по умолчанию:
Чтобы изменить версию Java по умолчанию, просто введите номер версии (число в столбце «Выбор») и нажмите Enter .
Выводы
Узнать, какая версия Java установлена в вашей системе Linux, очень просто, просто введите java -version .
Не стесняйтесь оставлять комментарии, если у вас есть вопросы.
How to check Java Version on Linux Ubuntu
It is practically a Turing-complete language so anything can be done on it. Most of the things one can do in Python can also be done in Java. Jpython is a Python version that runs on Java in the JVM (Java Virtual Machine). In this guide, we will dive into the procedure of looking up the Java version on Ubuntu Linux and install it if it is not already available.
Understanding the Java Version
The Java version is an indicator of the release of Java software currently under use by your OS.
It is highly recommended that the version be updated for better performance, stability, sophisticated features, and the latest security patches. This can go a long way and help you in preventing many unwanted issues and staying up to date.
Many websites, packages, or libraries require you to update to the latest Java version. So, it is preferred to stay one step ahead and have the latest release downloaded on your system. For instance, the latest Java version enables you to view 3D images along with other exciting features.
So, without further ado, let’s delve into the procedure of Java version verification and installation.
Checking Your Java Version
Start by checking your Java version. To do this, simply type the following in the terminal window.
This will give us the Java version that’s currently in use.
However, as evident from the picture above, Java isn’t installed on our system. But the terminal gives us options to install packages. Copying these commands and running them should get you the version installed directly via the terminal. All these versions are “headless”, meaning they don’t require a graphical user interface.
However, to download the latest release (16.02), you can use the browser method. Now, let’s go through the step-by-step process of installation.
Installing Java Using the Browser
Follow the steps to download Java.
Go to Google and search “download java JDK” and open the first link from the search results.
JDK is the “Java Development Kit” used to develop programs that run on Java. Alternatively, you can click on the link here to go directly to the page.
Under the “Java SE downloads”, go to “Java SE 16” as that is the latest version. The next step is to download JDK.
Scroll through the packages till you find the “Linux x64 Debian Package”. Download the file next to it. Ubuntu uses Debian packages to install programs, so you’ll see that the file has a .deb extension.
Once you are done with the download, open the folder where the downloaded package is located. Right-click anywhere in the window and select “Open in Terminal”.
Type the following command in the terminal to start unpacking the downloaded package.
You can replace the highlighted part of the command with the name of the package corresponding to the Java version you downloaded.
Having done that, you can type in the following command to confirm that Java is installed on your system.
With that out of the way, set your package as the alternative. To do that, use the following command:
Now, we can finally check and verify our version by typing the following:
To install the compiler, just use the same command as before, only this time replace “java” with “javac”.
To check the Javac version, type the following command:
Additionally, to set the java_home path, enter the following:
$ sudo update-a;ternatives —config java
$ sudo gedit / etc / environment
Once the text editor opens, paste the copied line and assign it to “JAVA_HOME” as demonstrated below.
Once this is done, clear the screen and type in the following commands to complete the process of Java home path configuration.
$ source / etc / environment
Some Important Commands
Given below are certain commands you can use to check your version alongside other important things.
(This command shows all the Java versions installed on your system.)
(Shows Java version you are using.)
(Shows version of Java you are currently using.)
(Shows the version of Java compiler.)
(To find the location of Java.)
Remove Java Versions
To remove Java from your system, you can type in the following command:
To remove the package:
Press “Y” followed by “ENTER” and the package will be uninstalled.
Should You Use JRE or JDK?
To run Java programs, you’ll need JRE (Java runtime environment). It is compatible with Windows, Linux, Mac, Solaris, and many more.
JDK (Java Development Kit) is used to develop Java applications. It is usually where most programmers start from. It depends on what you want to do.
When to Use JDK
- You want to write Java programs. It comes with a compiler and Java application launcher.
- Has access to the main Java libraries for coding via Java application launcher which opens JRE.
When to Use JRE
- You have to use libraries and other files. It does not have compiler and error detection agents of its own.
- When you have to use utility packages like math or data related sets and instructions.
- To run applications running on Java.
Some Applications of Java
Java is mainly used in:
- Building Android applications.
- In developing web and cloud applications.
- Software tools like Eclipse and Netbeans.
- Chatbots.
- Games.
- Scientific and Enterprise applications
Conclusion
To stay up to date and get a hands-on experience of the latest packages and software, keeping our programs updated is a must. This check and balance can really help us a long way in keeping our system efficient, protected, and up to date.
About the author
Zeeman Memon
Hi there! I’m a Software Engineer who loves to write about tech. You can reach out to me on LinkedIn.
Which java version command linux
Verify Java version
- Post published: September 5, 2020
- Post category:Java / Technology
Verify java version on Linux, Windows or Mac in multiple ways. You can even verify Java version online, by even using a browser. Java commands and Java Gui are the most popular ways to verify Java version. In Windows, Linux and Mac, commands and GUI differs somewhat. Lets see how we can verify Java installation is complete and what version is installed on your machine
Java version is verified using the command ‘java -version’ on windows, Mac and Linux. From GUI, Java control panel’s about section, Java version is clearly visible. Oracle’s online page for Java verification is the fastest way to check Java version, using Java enabled browser.
Steps to Verify Java version on windows using Java control panel
- Click on start button and start menu.
- Navigate through the ‘applications and programs’ listed unless you see the Java folder
- Click on Java folder, choose ‘About’ option.
- You can now check the Java installed version.
Steps to check Java version on windows using Command prompt
- From start menu or run box, Open the Command Prompt.
- Write the command: java -version
- The output of this command will show the Java version installed on your window machine.
Steps to check Java version on windows using start menu
- Click on start button and start menu.
- Navigate through the ‘applications and programs’ listed unless you see the Java folder
- Click on Java folder, Java control panel will be opened.
- In General tab, press the ‘About’ button.
- You can now check the Java installed version.
Steps to check Java version on Linux using Java control panel
- In Linux, search the application “Java control panel”
- From the search list, Open the Java control panel.
- On General tab, press the button ‘About…’
- It will open a popup which will show the installed Java version and details.
Java control panel – Java version check
Java control panel – Java version check
Steps to check Java version on Linux using terminal
- Press ALT+CTRL+T or Open the terminal from search.
- Enter the command: java -version
- The terminal will show the installed Java version on your Linux machine.
Steps to check Java version on Mac using Java control panel
- From upper left side of screen, select the Apple icon
- Navigate to System preferences.
- Press Java icon, it will launch Java control panel
- In General tab, press the button ‘About’
- You will see open a popup with details of Java installed version.
Steps to check Java version on Mac using terminal
- Open the terminal window.
- Enter this command: java -version
- The terminal window will show the installed version of Java on your Mac machine.
Steps to check Java version online
- Open the oracle’s Java verification web page.
- Press the button ‘Verify Java version’
- Accept the agreement and press Continue button
- Select Run to continue option
- The web page will show the Currently installed Java version.
- if you have recently finished Java installation, then restart your browser to enable, Java in the browser. Make sure JavaScript is enabled in the browser.
Where Java is installed?
You can find the Java installation path on Ubuntu using following command:
It will give path of Java installation directory, if you have multiple versions installed, then only the default Java version (set in your system) wll be displayed.
You can find the Java installation path on Ubuntu using following command:
It will give you Java installation path
How to switch Java version
You can have multiple installed versions of JDK on one machine. At any time, You can decide which Java version you want to make default version and should be used from command line automatically. The update-alternatives command is very helpful in switching between JDk versions, it will list all the installed Java versions. From that list, you can select which is the default version, you can want to keep.
All available Java versions will be listed as shown below, with a sequence number. You can select any Java version using these sequence numbers. An Asterisk (*) mark shows that this Java version is currently being used as default version.
Java version history
The Java language has undergone several changes since JDK 1.0 also as numerous additions of classes and packages to the core library. The evolution of Java language has been governed by the JCP (Java Community Process), which uses JSRs (Java Specification Requests) to specify changes and propose changes, for additions to the Java.
In addition to the language semantics, lots of other changes have been made to the Class Libraries over the years, which has now grown from a couple of hundred classes to over three thousand. Entire new APIs, like Swing and Java2D, are introduced, and lots of of the first JDK 1.0 classes and methods are deprecated.
Year | JDK release |
1995 year | JDK Beta |
1996 Jan | JDK 1.0 |
1997 Feb | JDK 1.1 |
1998 Dec | J2SE 1.2 |
2000 Mat | J2SE 1.3 |
2002 Feb | J2SE 1.4 |
2014 Sep | J2SE 5.0 |
2006 Dec | Java SE 6 |
2011 July | Java SE 7 |
2014 Mar | Java SE 8 (LTS) |
2017 Sep | Java SE 9 |
2018 Mar | Java SE 10 |
2018 Sep | Java SE 11 (LTS) |
2019 Mar | Java SE 12 |
2019 Sep | Java SE 13 |
2020 Mar | Java SE 14 |
2020 Sep | Java SE 15 |
2021 Mar | Java SE 16 |
2020 Sep | Java SE 17 (LTS) |
Java version history
OpenJDKs list with download links
There are lots of OpenJDKs builds available, most of them are available to use freely for commercial purpose. But still few have different type od supports or licenses. Following is the list for different available OpenJDK builds.
OpenJDK Builds | Long Term Support | Permissive license | Commercial Support |
AdoptOpenJDK | Yes | Yes | Yes |
IBM SDK | Yes | Yes | Yes |
Alibaba Dragonwell | Yes | Yes | No |
Amazon Corretto | Yes | Yes | No |
Azul Zulu | Yes | Yes | Yes |
BellSoft Liberica JDK | Yes | Yes | Yes |
ojdkbuild | Yes | Yes | No |
Oracle OpenJDK | No | Yes | No |
Red Hat build of OpenJDK | Yes | Yes | Yes |
SAP SapMachine | Yes | Yes | No |
OpenJDKs build with download links
What is Java Auto Update? How do I change notify settings?
Java Update feature is a feature that keeps your computer up-to-date with the newest Java releases. once you have auto update enabled, your system periodically checks for latest versions of Java. When a latest version is found we ask your permission to upgrade your Java installation. you can schedule how often to see for updates, or check manually at any time.
Change Automatic Java Update Settings
- Open the Java control panel window.
- Click the Update tab and open settings section.
- select the Check for Updates Automatically check box, To enable Java Updates automatically.
- For disabling Java Updates, un-select the Check box for Updates Automatically check box.
Change the Java Update Schedule
- You can also change the frequency for Java updates: monthly (default), weekly, or daily
- On Update tab in Java Control panel window, click button Advanced
- Advanced Settings dialog appears for the Automatic Update .Change frequency here using date and time for the Java Update and Click OK.
- Java Update scheduler will now check for latest Java updates and notify you at the scheduled frequency.
- For daily updates, you’ll select the time of the day for the update. For weekly updates, you’ll select the day of the week and therefore the time of the day. For monthly updates, you’ll select the day of the week and therefore the time of the day. Monthly updates check weekly and notify you within 30 days that an update is out there , however, if an update is taken into account critical you’re notified within every week of its release.
Change the Notification Options
There are two choices for changing notification options:
Before installing: Use this feature to download automatically and be notified before installing the Java update.
Before downloading: this is often the default . Use this feature to be notified before downloading and installing the Java update.
Manual Update Option
From the Java control panel Update tab, you’ll manually check for an update any time by clicking on the Update Now button located at rock bottom of the Update tab on the Java control panel . Java Update can only be run if the system is connected to the web . Alternatively, you’ll go to Java.com to find the newest Java version. After updating the Java version, you would like to shut and restart the Java control panel to load the updated control panel .
Conclusion
The choice of Java version depends upon your requirements and decision, but to verify Java version, options remain the same. Same commands can be used to check Java version for any JDK. If you want o have new Java installation and looking for Java installation detailed steps, then you can refer to my detailed guide on How to install Java.