Introduction
Java runs many of the applications that we use daily. Many applications cannot run on older versions of Java. Hence, it is essential to know which version is installed on your system.
In this tutorial, learn how to check the Java version on your Mac or Windows system.
Prerequisites
- A system running macOS or Windows
- Access to the command-line/terminal window
- A version of Java installed
Check Java Version on Mac
You can find the version of Java on macOS by:
- using the GUI (Mac’s System Preferences)
- prompting for the version in the terminal window
Option 1: Check Java Version on Mac Using the GUI
To check the Java version on Mac without using the terminal by searching for the Java Control Panel in the System Preferences.
1. Click the Apple icon in the menu bar to open the drop-down menu and navigate to System Preferences.
2. A new window opens with various icons and settings. Find and click the Java icon to open the Java Control Panel.
3. Once the Java Control Panel opens, click the About button. A new window with Java version information should appear.
Option 2: Check Java Version on Mac Using the Terminal
If you prefer using the terminal, checking the Java version is a simple one-command process.
1. First, open the terminal. To do so, click the Spotlight Search button in the top-right of the screen.
2. Type terminal in the search bar and open it by clicking on the icon in the search results.
3. Once in the command line, run the command: java -version
. The output should display the Java version installed on your MacOS.
To check the version of the primary Java compiler – javac (pronounced “java-see”) use the command:
javac -version
Note: If you have a Linux system, refer to How To Check Java Version Installed On Linux.
Check Java Version on Windows
To check the Java version on a Windows computer, you can use:
- the GUI (Windows Control Panel)
- the command line
Option 1: Check Java Version on Windows Using GUI
To find the Java version on your Windows without opening a terminal window, use the Control Panel.
1. Open the Windows menu in the bottom-left corner and type control panel in the search bar.
2. Find the Control Panel in the search results and click the icon to open it.
3. Move to the Programs directory.
4. Find and click the Java icon to open the Java Control Panel.
5. Once the control panel opens, click the About button.
6. The About Java window should appear and display the Java version on your computer.
Option 2: Check Java Version on Windows Using Command Line
Another option to find the Java version on Windows is through the command line.
1. Open the Windows Start menu in the bottom-left corner and type cmd in the search bar.
2. Then, open the Command Prompt once it appears in the search results.
3. A new window with the command prompt should appear. In it, type the command java -version
and hit Enter. The output should display the Java version installed on your Windows system.
You can also check the version of the Java’s primary compiler, javac, with the command:
javac -version
Conclusion
This article showed you how to check the version of Java installed on a macOS or Windows system.