# How to check if Java is installed

By Atta Ur Rehman Shah (https://attacomsian.com/about). Published Feb 21, 2021. Topics: Java, DevOps, Linux.
Canonical URL: https://attacomsian.com/blog/check-if-java-is-installed

> Learn how to check if Java is installed on a Windows 10, Mac OS X, or Linux/Unix machine.

There are multiple ways to check if Java is installed on a Windows 10, macOS X, or Linux machine. The simplest way is to use the command-line tool.

Open your command-line tool and type the following command:

```bash
$ java -version
```

If [Java is installed](https://attacomsian.com/blog/install-java-on-ubuntu) and PATH is configured correctly, you should see output similar to the following:

```bash
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
```

If Java is not installed or misconfigured, you'll see the following output:

```bash
zsh: command not found: java
```

The above message is displayed by a macOS X machine. You may see a different message depending on the operating system used and the Java version installed.
