YouTube Icon

Code Playground.

How to Check Java Version

CFG

How to Check Java Version

Java is one of the most well known programming dialects on the planet, utilized for building various kinds of cross-stage applications. 

This article discloses how to check what adaptation of Java is introduced on your Linux framework utilizing the order line. This can be valuable when introducing applications that require a particular rendition of Java. 

Java Versioning

Java utilizes semantic forming . Creation prepared deliveries are formed in the accompanying plan: 

MAJOR.MINOR.SECURITY

For instance, in Java 11.0.8, 11 is a significant rendition, 0 is a minor form, and 8 is a security adaptation. 

  • MAJOR - Major deliveries are bringing new highlights and capacities. 
  • MINOR - Minor deliveries contain different bug fixes and viable upgrades. 
  • SECURITY - Security discharges give basic security fixes. 
java -version

To discover which Java adaptation is introduced on your framework, run the java - form order: 

Output

openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

In this model, we have Java variant 11.0.8 introduced on our framework. The variant introduced on your framework might be extraordinary. 

In the event that you get "java: order not discovered" it implies that Java is no introduced on the framework. To introduce Java, utilize one of the accompanying aides, contingent upon your Linux dispersion: 

Introduce Java on Ubuntu. 

Introduce Java on Debian. 

Introduce Java on CentoS. 

The framework may likewise have various forms of Java introduced simultaneously. To check whether you have various Java establishments on your machine run: 

sudo update-alternatives --config java

On the off chance that you have just a single Java establishment, the yield will look something like this: 

Output

There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java
Nothing to configure.

Nothing to arrange. 

Something else, in the event that you have numerous Java establishments, the order will show a menu where you can choose which form will be the default Java variant: 

There are 3 decisions for the elective java (giving/usr/canister/java). 

There are 3 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

Press <enter> to keep the current choice[*], or type selection number:

To change the default Java rendition, simply enter the adaptation number (the number in the Selection section) and press Enter. 

Conclusion 

Discovering what Java variant is introduced on your Linux framework is exceptionally simple, simply type java - rendition. 

Don't hesitate to leave a remark on the off chance that you have any inquiries.




CFG