Home
Check Your Java Installation
Before we dive into Java coding, we need to make sure we have a recent Java version installed.
Tip: Any Java version 11 or higher will be fine for getting started with Java today.
Step 1. Open a Terminal Window.
- On Windows, click Start, type
cmd
, and hit Enter. - On Mac OS X, go to Launchpad, and search for "Terminal".
- On Linux, go to Applications and search for "Terminal".
Step 2. In the Terminal, enter the command java -version
You should get output similar to the below.
java -version openjdk version "21.0.4" 2024-07-16 LTS OpenJDK Runtime Environment Zulu21.36+17-CA (build 21.0.4+7-LTS) OpenJDK 64-Bit Server VM Zulu21.36+17-CA (build 21.0.4+7-LTS, mixed mode, sharing)
Make sure that the version shown above in your Terminal is any Java version 11 or higher.
In this case, you have OpenJDK installed and you're all set to run and write Java code.
If you get any of the following results, instead of the above, you need to install OpenJDK.
'java' not recognized as an internal or external command, operable program or batch file.
command not found: java
Command 'java' not found, did you mean...
Go to one of the following pages for details on installing OpenJDK: