How to check if Java is installed

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:

$ java -version

If Java is installed and PATH is configured correctly, you should see output similar to the following:

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:

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.

✌️ Like this article? Follow me on Twitter and LinkedIn. You can also subscribe to RSS Feed.

You might also like...

Digital Ocean

The simplest cloud platform for developers & teams. Start with a $200 free credit.

Buy me a coffee ☕

If you enjoy reading my articles and want to help me out paying bills, please consider buying me a coffee ($5) or two ($10). I will be highly grateful to you ✌️

Enter the number of coffees below:

✨ Learn to build modern web applications using JavaScript and Spring Boot

I started this blog as a place to share everything I have learned in the last decade. I write about modern JavaScript, Node.js, Spring Boot, core Java, RESTful APIs, and all things web development.

The newsletter is sent every week and includes early access to clear, concise, and easy-to-follow tutorials, and other stuff I think you'd enjoy! No spam ever, unsubscribe at any time.