🌐
Oracle
java.com › en › download › help › version_manual.html
How to find Java version in Windows or Mac - Manual method
You can determine which version of the JDK is the default by typing java -version in a Terminal window. If the installed version is 7u55, you will see a string that includes the text 1.7.0_55.
🌐
HubSpot
blog.hubspot.com › home › website › how to check your java version in windows & mac
How to Check Your Java Version in Windows & Mac
February 27, 2025 - This will bring up the command line. From here, you enter the same command as in Windows, java -version to get your current version details. Worth noting? On both Windows and Mac devices, you can use the command javac -version to check the version ...
Discussions

macos - How do I check if the Java JDK is installed on Mac? - Stack Overflow
annnnnnd it returns -127 if /usr/libexec/java_home doesn't even exist... so this actually works both ways ;-) 2023-07-19T16:20:38.007Z+00:00 ... Save this answer. ... Show activity on this post. Open terminal. ... Also you can verify manually by going to the specific location and then check. To do this run below command in the mac terminal ... Then run ls command in the terminal again. Now you can see the jdk version ... More on stackoverflow.com
🌐 stackoverflow.com
Check Java version from Command Line
I have a Java installation and I have only access via bash. How can I check the Java version from command line. More on community.spiceworks.com
🌐 community.spiceworks.com
6
5
May 28, 2020
Setting JAVA_HOME path
It means that you have not configured the JAVA_HOME environment variable. Using a virtual terminal application, type in: update-alternatives --config java, which will give you the location of JDK listed under Path column. Depending on the installed version of JDK, it will be something like: /usr/lib/jvm/java-14-openjdk-amd64/bin/java If you have installed multiple versions of JDK, all of them will be listed here 2. Using text editor such as nano and terminal emulator, type in: nano /etc/profile.d/jdk_home.sh This will create and open for editing a new script file named jdk_home.sh under the location /etc/profile.d, where you need to type in: export JAVA_HOME= where JDK-Location should not include the /bin/java directories. For example: EXPORT JAVA_HOME=”/usr/lib/jvm/java-14-openjdk-amd64” This will set your environment variable JAVA_HOME The steps above are if you have installed JDK using apt package manager tool, you also have the option of using SDKMAN which will configure all environment variables for you automatically. More on reddit.com
🌐 r/vscode
12
1
February 27, 2020
Zircon, a text GUI library | Version 2017.2.0 released!
Huh, this might be pretty interesting to make a roguelike or something like that. Will definitely be keeping an eye on this. More on reddit.com
🌐 r/java
24
47
October 2, 2017
People also ask

How do I check my version of Java with the command prompt?
Open Command Prompt, type java -version, then press Enter. This will print out the current version of Java that you're running, as well as the build number.
🌐
wikihow.com
wikihow.com › computers and electronics › software › programming › java › how to check your java version in the windows command line
How to Check Your Java Version in the Windows Command Line
How do I check the Java version inside a shell script?
Parse the output of `java -version`, which prints to standard error: ```bash java -version 2>&1 | head -n 1 | awk -F '"' '{print $2}' ``` This returns a string such as `21.0.4` that you can compare in your script.
🌐
linuxize.com
linuxize.com › home › java › how to check java version
How to Check Java Version | Linuxize
Does `java -version` show the JDK or the JRE?
It shows whichever runtime is set as the default. Both the JRE-only package and the full JDK include the `java` command. To confirm that the JDK is installed, check for `javac` as described above.
🌐
linuxize.com
linuxize.com › home › java › how to check java version
How to Check Java Version | Linuxize
🌐
Intercom
intercom.help › all collections › printers and scales › troubleshooting › how to check java version in windows or mac
How to Check Java Version in Windows or Mac | Upright Labs Help Center
March 4, 2024 - In it, type the command java -version and hit Enter on your keyboard · The output should display the Java version installed on your Windows system ​Note: This should say OpenJDK version 11.x ... A new window with the terminal should appear ...
Top answer
1 of 11
293

javac -version in a terminal will do

2 of 11
115

You can leverage the java_home helper binary on OS X for what you're looking for.

To list all versions of installed JDK:

Copy$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.8.0_51, x86_64:   "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home
    1.7.0_79, x86_64:   "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

To request the JAVA_HOME path of a specific JDK version, you can do:

Copy$ /usr/libexec/java_home -v 1.7
/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

$ /usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home

You could take advantage of the above commands in your script like this:

CopyREQUESTED_JAVA_VERSION="1.7"
if POSSIBLE_JAVA_HOME="$(/usr/libexec/java_home -v $REQUESTED_JAVA_VERSION 2>/dev/null)"; then
    # Do this if you want to export JAVA_HOME
    export JAVA_HOME="$POSSIBLE_JAVA_HOME"
    echo "Java SDK is installed"
else
    echo "Did not find any installed JDK for version $REQUESTED_JAVA_VERSION"
fi

You might be able to do if-else and check for multiple different versions of java as well.

If you prefer XML output, java_home also has a -X option to output in XML.

Copy$ /usr/libexec/java_home --help
Usage: java_home [options...]
    Returns the path to a Java home directory from the current user's settings.

Options:
    [-v/--version   <version>]       Filter Java versions in the "JVMVersion" form 1.X(+ or *).
    [-a/--arch      <architecture>]  Filter JVMs matching architecture (i386, x86_64, etc).
    [-d/--datamodel <datamodel>]     Filter JVMs capable of -d32 or -d64
    [-t/--task      <task>]          Use the JVM list for a specific task (Applets, WebStart, BundledApp, JNI, or CommandLine)
    [-F/--failfast]                  Fail when filters return no JVMs, do not continue with default.
    [   --exec      <command> ...]   Execute the $JAVA_HOME/bin/<command> with the remaining arguments.
    [-R/--request]                   Request installation of a Java Runtime if not installed.
    [-X/--xml]                       Print full JVM list and additional data as XML plist.
    [-V/--verbose]                   Print full JVM list with architectures.
    [-h/--help]                      This usage information.
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › java › how to check your java version in the windows command line
How to Check Your Java Version in the Windows Command Line
February 24, 2025 - Type java -version and press ↵ Enter. Once you run this command, you'll see the Java version next to "java version" on the first line. To check the version of the Java compiler, use javac -version.
🌐
Mac Install Guide
mac.install.guide › java › version
Check Java Version on Mac · Mac Install Guide · 2026
How to check Java version on Mac with java -version in terminal. Find your JDK location, list installed Java versions, and troubleshoot macOS Java issues.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › how-to-check-java-version-in-linux
How to Check Java Version in Linux - GeeksforGeeks
July 23, 2025 - Here are 4 ways to check your Java version on Linux: In your linux command terminal, type the following java command and press Enter:
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › java › how to check java version on a mac: 2 simple methods
How to Quickly and Easily Check Java Version on a Mac
September 28, 2025 - To check the Java version on your Mac, open System Settings and select the "Java" menu item. You can open a terminal and type the command java -version to see your Java version.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check java version installed on linux
How to Check Java Version Installed on Linux
December 11, 2025 - You can also prompt the system to list installed packages and search for the Java version. To generate a list of all installed packages, use the command: ... Scroll up or down until you find the Java packages, as shown in this example. To avoid searching through all installed packages, list Java packages only. Prompt the system to list Java packages by searching for openjdk with grep: ... This article explained how to check the Java version on Linux using three different methods.
🌐
Linuxize
linuxize.com › home › java › how to check java version
How to Check Java Version | Linuxize
March 29, 2026 - If you need to compile Java code, you also need the Java Development Kit (JDK). To check whether the JDK is installed and which version it provides, run: Terminal · javac -version · The output shows the compiler version: output ·
Top answer
1 of 4
121

The simplest way is:

update-java-alternatives -l shows you all the Java versions you have installed.

java -version shows you the Java version you are using.

java -showversion shows you the Java version you are using and help.

Normally it would be OpenJDK.

2 of 4
43

This command should tell you what is currently providing the Java virtual machine (java) and the Java compiler (javac):

file /etc/alternatives/java /etc/alternatives/javac

This assumes the "alternatives" system is working properly, which might not be the case, depending on how Java has been "messed up" in the past. To check this, run:

file `which java javac`

If the alternatives system is working correctly and being used by Java, then you should see:

/usr/bin/java:  symbolic link to `/etc/alternatives/java'
/usr/bin/javac: symbolic link to `/etc/alternatives/javac'

Otherwise please edit your question to provide details. Then it should be possible to give a more specific answer.


You can remove openjdk-6 with the Software Center. There are multiple packages associated with it, so you may need to remove more than one packages. (All the `openjdk-6 packages are listed here.)

Or you can use the command-line:

sudo apt-get remove openjdk-6-\* icedtea-6-\*

However, whichever method you use, you may want to check first to see what depends on these packages--you might have software installed that specifically needs version 6. (Probably not, but possibly.)

You can check for this by simulating the removal operation on the command-line:

apt-get -s remove openjdk-6-\* icedtea-6-\*

This will show you the effects of removing those packages, including what other packages would be removed as well. (You'll notice that since this is a simulation, you don't need sudo.)

If you want to be able to continue using Java content online in your web browser (this is not the same thing as JavaScript), then before you remove any icedtea-6- or openjdk-6- packages (except perhaps openjdk-6-jdk), you should make sure you have icedtea-7- packages installed corresponding to whatever icedtea-6- packages are installed.

🌐
Scaler
scaler.com › home › topics › how to check java version?
How to Check Java Version? - Scaler Topics
March 21, 2024 - Once the terminal is open type Java -version in the terminal. Open System Preference and click on the java icon. You will get a small window with the name Java Control Panel. Go to the Update and you will get the information regarding the installed ...
🌐
Refreshjava
refreshjava.com › java › checking-java-installation
How to verify java version and java installation - RefreshJava
Execute java -version or javac -version command in cmd(in windows) or terminal(in linux), if it returns the version correctly, that means java is installed and setup properly in your system.
🌐
Mkyong
mkyong.com › home › java › how to check the installed jdk version on your computer
How to check the installed JDK version on your computer - Mkyong.com
November 26, 2024 - In the terminal, we can use `javac -version` to check the JDK version, and `java -version` to check the JRE version.
🌐
DataFlair
data-flair.training › blogs › verify-java-version
Verify Java Version in Windows, Linux and Mac - DataFlair
July 26, 2022 - Like Linux, in mac also, we can check the java version by typing java -version in the terminal.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check java version on mac
How to Check Java Version on Mac (2 Simple Options)
December 16, 2025 - 2. Type Terminal and open it by selecting the relevant search result. ... The output displays the Java version installed on macOS. To check the version of the primary Java compiler (javac), use the command below:
🌐
JavaBeat
javabeat.net › home › how to check java version? windows | mac | linux
How to Check Java Version? Windows | Mac | Linux
May 6, 2024 - To check the Java version on Windows, Linux, or Mac operating systems, run the “java --version” command from the respective terminal.
🌐
Linux.org
linux.org › home › forums › general linux forums › general linux topics
Check Java version from Command Line | Linux.org
May 28, 2020 - you can do a few things: bash-5.0$ java -version java version "1.8.0_231" Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode) bash-5.0$ bash-5.0$ bash-5.0$ which java /usr/lib64/java/bin/java bash-5.0$ echo $JAVA_HOME ...