Have you ever wondered if your computer has Java installed? Or maybe, you’re trying to run a certain application and it screams, “Java not found!” Don’t worry — checking your Java version is easier than you might think. Whether you’re on a Windows or Mac, this handy trick will help you figure it out in seconds!
Why You Need to Know Your Java Version
Java is the magic behind many apps and websites. But different apps need different Java versions. If you’re using the wrong one, things can crash or not load at all. Yikes!
Staying updated also helps keep your system safe from bugs and security issues. So it’s a good habit to check once in a while.
So, what’s the trick?
Brace yourself for a life-changing command… ready?
java -version
Yes, that’s it! Just type this into your terminal or command prompt. Let’s look at where and how to do this on your computer.
Check Java Version on Windows
Follow these quick steps:
- Click on the Start menu.
- Type cmd in the search box. Hit Enter.
- In Command Prompt, type java -version and press Enter.
You’ll see something like:
java version "17.0.2" 2022-01-18 LTS Java(TM) SE Runtime Environment
This tells you which Java version is installed. If it says something like “java is not recognized,” that means Java isn’t installed — or not set up properly.

Check Java Version on Mac
Easy as pie! Here’s how:
- Open Terminal (press Command + Space, then type “Terminal”).
- Type java -version and press Return.
You’ll see an output like:
java version "11.0.13" 2021-10-19 LTS Java(TM) SE Runtime Environment
If you see a pop-up asking you to install Java, that means it’s missing. But don’t panic! It’s easy to install.
Another Cool Trick!
Want to know where Java is installed on your system? Try this:
where java
For Windows.
which java
For Mac.
This will show the full path to your Java installation — super useful for setting up development environments.
Still Not Working?
If you don’t see a version or get an error, do this:
- Go to the official Java website.
- Download the latest version.
- Install it like any regular program.
- Reopen your command prompt or terminal and try again.

Bonus Tip: Set Your JAVA_HOME
For developers, you might need to set the JAVA_HOME
environment variable:
- It tells your system where Java lives.
- On Windows, go to Environment Variables & add the path to Java.
- On Mac, you can set it in your shell profile (like
~/.zshrc
).
Wrap-Up
See? It wasn’t so scary after all! Just one command and you know your Java version.
java -version — the hero of the day!
So whether you’re installing Minecraft mods, working on a school project, or just curious — this simple trick saves the day.
Now go ahead, open that terminal and type like a pro!
I’m Sophia, a front-end developer with a passion for JavaScript frameworks. I enjoy sharing tips and tricks for modern web development.