Finding your Java version on Windows, Mac, or Linux
The fastest way to check your Java version is to open a command window on your computer and run a single command. On Windows, this is the Command Prompt. On Mac or Linux, it is the Terminal. Once you open it, type java -version and press Enter. Your computer will display the exact version number within seconds.
If nothing appears or you see an error message saying "java is not recognized" or "command not found", Java is either not installed on your computer or your system does not know where to find it. This is common and does not mean something is broken — it usually means Java was never set up to work from the command line, or you need to reinstall it.
Key Takeaways
- Open Command Prompt on Windows or Terminal on Mac and Linux, then type java -version to see your Java version when ready.
- If you see an error message, Java is either not installed or your system cannot find it from the command line.
- Some programs install their own copy of Java that does not show up in the command line check, so you may have Java running without knowing it.
- Java version numbers follow a pattern: older versions use numbers like 8 or 11, while newer ones use the year they were released, like 21 or 23.
Step-by-step for Windows
Click the Windows Start button in the bottom left corner. Type cmd into the search box and press Enter. A black window will open — this is Command Prompt. At the blinking cursor, type java -version exactly as shown and press Enter.
Your version number will appear in the next line or two. It will look something like "java version 11.0.15" or "openjdk version 21.0.1". The first number (11, 21, 8, etc.) is what most people mean when they say "Java version". Write this number down if you need it for a program or website.
Step-by-step for Mac
Open Spotlight search by pressing Command and Space at the same time. Type terminal and press Enter. A white or dark window will open. At the prompt, type java -version and press Enter.
Your version will display when ready below. On Mac, you may also see information about whether you have "OpenJDK" or "Oracle JDK" — both are legitimate versions of Java, and either one works for most purposes. The version number itself is what matters for checking compatibility.
Step-by-step for Linux
Open your terminal process. The exact way to do this depends on your Linux distribution, but it is usually in your applications menu or accessible by right-clicking the desktop. Once the terminal is open, type java -version and press Enter.
The version number will appear in the output. Linux users often have multiple versions of Java installed, so if you need a specific one, you can type update-alternatives --list java to see all installed versions. This is less common on Windows or Mac.
What to do if Java is not found
If you see "java is not recognized" on Windows or "command not found" on Mac or Linux, Java either is not installed or your system does not know where to find it. The first step is to check whether Java is actually on your computer. On Windows, go to Control Panel, select Programs, then Programs and Features, and look for anything with "Java" in the name. On Mac, open Applications and look in the Utilities folder for Java Preferences or check Applications directly.
If you find Java listed but the command line still does not recognize it, you need to set up the PATH — a list of locations your computer checks when you type a command. This is more technical and varies by system. A simpler solution is often to reinstall Java from the official website (java.com or adoptium.net), which will set everything up correctly during installation.
Understanding what the version number means
Java version numbers changed their format in 2018. Older versions used straightforward numbers: Java 8 was released in 2014, Java 11 in 2018. Starting in 2018, Oracle switched to releasing a new version every six months, numbered by year and month. Java 21 came out in September 2023, Java 23 in September 2024. Both numbering systems are still in use, so you might encounter either one.
When a program says it needs "Java 11 or higher", it means any version from 11 onward — that includes 17, 21, 23, and future versions. If it says "Java 8", it means specifically that older version or anything newer. The version number you see in the command line output is the one you need to check against whatever requirement you are looking at.
When Java is installed but does not show up
Some programs bundle their own copy of Java inside them so they do not depend on what you have installed system-wide. If you run a program that uses Java but the command line check shows nothing, this is likely what is happening. The program works fine — it just does not use the system Java.
This is actually common and not a problem. It means the program has its own version built in and does not need you to install anything separately. If you need to know what version that program is using, check the program's settings or documentation, because the command line check will not find it.
Frequently Asked Questions
Why do I need to know my Java version?
Some programs or websites require a specific Java version to run. Knowing your version lets you check whether your computer meets that requirement. You might also need it for troubleshooting if a Java-based program is not working correctly.
Is Java the same as JavaScript?
No. Java and JavaScript are completely different languages with similar names. JavaScript runs in web browsers and does not require installation. Java is a separate program that runs on your computer. You can have one, both, or neither.
Do I need Java installed?
Most people do not need Java. It is only required if you use a specific program or tool that depends on it. If you have never heard of Java before and nothing on your computer asked for it, you probably do not need it.
What if I see multiple Java versions listed?
This can happen on Linux or if you have installed Java multiple times. The version that appears when you type java -version is the one your system uses by default. If you need a different version to be the default, you can change it, but this is uncommon and usually only necessary for developers.
Is it safe to update Java?
Yes. Java updates are generally safe and often include security fixes. If a program requires a specific version, updating may break that program, so check the program's requirements first. Most modern programs work with multiple Java versions, so updating is usually fine.