Java is a platform-independent, popular, simple, secure, and statically typed programming language. Before we discuss, let’s clarify that the Java language needs a runtime platform, so before we go any further, let’s clarify how Java is present on the machine.
The Java language comprises three main components:
Java
- Development Kit
- Virtual Machine
- Runtime
Java Runtime Environment Java
Concepts that we will only check if Java is there on the Platform (Operating System + Architecture)
1. Java Virtual Machine
This is machine-specific
software that is responsible for the bytecode on that machine and converts it into machine-specific instructions.
JVM is different for Windows JVM is different for Linux JVM is different for different platforms
So as a programmer, we don’t need to check the presence on the machine, as it is pre-installed on the machine. It is responsible for executing Java code line by line.
2. Java Runtime Environment
It is simply a package thatprovides an environment to run our java code only on the machine. There is no development here due to the absence of development tools.
3. Java Development Kit It is
also a package that provides an environment to develop and run where JRE is part of it along with
development tools.
JDK = JRE + Development
- Tools JRE
- = JVM + Library Classes
Now, the
first and most important step is to check the Java Development Kit on Windows, which is also known as JDK. There are many versions of Java. Depending on the methods of the operating system, there are several methods to find the version of JAVA installed on your machine:Let’s
discuss 3 standard methods on Windows
- User needs to open the command prompt and enter
- control panel and look for
- Java directories method- Click on the ‘Start’ menu and type About.java or readme file
-‘java-version’Open the
the
Taking one by one, showing in depth individually
1. Command Prompt
The CMD (Command Interpreter) is a command line interface. Supports a set of commands and utilities; and has its own programming language for writing batch files. Open CMD and search for java -version. First, we have an environment variable to the location of the installed path of the java folder. Otherwise, it will display an invalid command. It is called ‘Terminal’ in the case of mac operating systems.
java -version // CMD/Terminal Command to check the version of java on the machine In the case of
Windows operating system: It shows that java is installed on the machine with version 1.8.0 (See carefully on line number 5)
“
1.8.0_144″ is the version of java
In the case of macOS: It is showing that java is installed on the machine with version 14.0.1 (see carefully on line number 2)
Second Method
: Open Control Panel and there is a java option in
- the Control Panel interface
- Click on the java option and click on about a small pop-up window will appear
For
Windows
:
For Mac: Click the Java icon below. System preferences on Mac are the same as in Windows Control Panel.
<img src="https://media.geeksforgeeks.org/wp-content/uploads/20201027031341/Mac2.png" alt="Mac2.png" /
>
Third method
:
Search Program and Features in Control Panel and search JAVA Named option
In the case of Windows: Simply custom search- About Java
For Mac
: Press the command button followed by a
spacebar without moving your fingers from the command button.
A pop-up box
will appear for less than a second followed by a pop-up box as shown below: