- Test current java version
- How to switch Java version
- Java version history
- JDK 14: New hot Features
- Test current java version
- Method 1: Ask Java
- 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
- 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
- Test current java version
- Learn Latest Tutorials
- Preparation
- Trending Technologies
- B.Tech / MCA
- Javatpoint Services
- Training For College Campus
Test current java version
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.
sudo update-alternatives --config java
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.
There are n choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode * 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode 3 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode Press to keep current choice[*], or type selection number:
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.
JDK 14: New hot Features
May 16, 2020
Test current java version
—>What Version of Java Are You Using?
On a computer with multiple web browsers, be sure to check the Java version in every browser. I say this because multiple copies of Java can sometimes be installed with different browsers using different copies. Also, Java can be enabled in one browser and disabled in another.
Note: The portion of Java that runs programs is referred to as either the Java Run-time Environment (JRE) or the Java Virtual Machine (JVM).
Method 1: Ask Java
This is my favorite — straight from the horse’s mouth (so to speak). The Java Run-time Environment is aware of its version and the company that authored it. So I wrote a very simple applet (the source code is on the About page) that gets this information from the JRE and displays it in a pink rectangle.
If Java is working, you will see a pink rectangle above with one line of text that says something like:
Java Version 1.8.0_25 from Oracle Corporation or
Java Version 1.7.0_67 from Oracle Corporation or
Java Version 1.6.0_45 from Sun Microsystems Inc. or
Java Version 1.6.0_33 from Apple Inc.
In part this is because the applet is unsigned. In the Bizarro world of Oracle, unsigned applets are treated as more dangerous than signed applets. This is backwards for two reasons. First, unsigned applets run in a restricted Java sandbox whereas signed applets are given unrestricted access to the system. Yes, the sandbox has been buggy and broken, but some security is better than none. Second, it shows a faith in the Certificate Authority system that is unwarranted.
Java on Mac Computers
The rest of this topic is a bit dated, so it has been suppressed by default.
At times Java on OS X was complicated as Java 6 came from Apple and Java 7 came from Oracle.
For many years this page had eight other methods of determining the installed version of Java.
But the page got really big, so they are no longer shown by default. But, they are still available:
Website created and maintained by Michael Horowitz mh _at_ javatester.org
Java and JavaScript are trademarks of Oracle in the US and other countries. This site is independent of Oracle.
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:
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:
update-alternatives --list java
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.
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:
sudo apt list --installed | grep -i 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.
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:
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:
update-alternatives --list java
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.
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:
sudo apt list --installed | grep -i 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.
Test current java version
Learn Latest Tutorials
Preparation
Trending Technologies
B.Tech / MCA
Javatpoint Services
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
- Website Designing
- Website Development
- Java Development
- PHP Development
- WordPress
- Graphic Designing
- Logo
- Digital Marketing
- On Page and Off Page SEO
- PPC
- Content Development
- Corporate Training
- Classroom and Online Training
- Data Entry
Training For College Campus
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week
Like/Subscribe us for latest updates or newsletter