you might need to add path in environment variables which you can find in Control Panel open the Jdk where you installed and add until /bin in the path in environment variables.

Add until /bin in path variable in System Variables which is residing in Environment Variables.

Then do java -version which might show up.

If still problem persists, try restarting your pc and see.

Answer from ganga on Stack Overflow
🌐
IBM
ibm.com › docs › en › sdk-java-technology › 8
IBM SDK, Java Technology Edition 8
You obtain the IBM build and version number for your Java installation by using the -version or -fullversion options. You can also obtain version information for all jar files on the class path by using the -Xjarversion option.
Discussions

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
How can I see all installed Java versions?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
7
1
December 15, 2021
CMD does not recognize the java -version command?
But what's in PATH though? Remove old Java directories from this variable and keep only the right one, better to write just "${JAVA_HOME}/bin" instead of full paths More on reddit.com
🌐 r/javahelp
13
0
August 15, 2025
Can anyone tell me how to check JDK version? Not Java Version. JDK
Go to Program Files\Java and look at the JDK folder name. More on reddit.com
🌐 r/java
6
0
February 4, 2011
🌐
Oracle
java.com › en › download › help › version_manual.html
How to find Java version in Windows or Mac - Manual method
The Add/Remove control panel displays a list of software on your system, including any Java versions that are on your computer. ... The Java Runtime (JRE) that you download from java.com or oracle.com contains a plugin to run Java content from your browser. In order to use the command line tools, you will need to download the Java Development Kit (JDK).
🌐
FICO
fico.com › fico-xpress-optimization › docs › dms2021-02 › insight_install › GUID-6047F973-9AB8-44FB-837F-78B191D38F77.html
Checking Java Version
Xpress Insight 4.56 requires Java 11 to be installed. Xpress Insight supports any OpenJDK. FICO recommends Amazon Coretto 11. For more, see the Amazon Corretto overview. ... Open a Command Prompt. Type the following command: java -version.
🌐
T Wallet
twallet.telangana.gov.in › TABiometric › data › Java Check.pdf pdf
How to check whether java is installed on the computer?
Other ways to check if java is installed: - 1. Open command prompt and enter “java –version”. If installed version number is displayed. 2. On Windows, Java is usually installed in the directory C:/Program Files/Java. You can check · if this folder exists.
Find elsewhere
🌐
Reddit
reddit.com › r/javahelp › how can i see all installed java versions?
r/javahelp on Reddit: How can I see all installed Java versions?
December 15, 2021 -

When I write "java --version" in the command line I only get one java version, which just happens to be the one in the environment variables. However I know that I have at least two versions installed, because I had to install an old version in order for some program to work. How does this stuff work? Thanks in advance

Top answer
1 of 3
2
Most operating systems determine what executable is run using a PATH. The version that is found first in your PATH is the one that's executed. If you need to run a different version you need to change your PATH.
2 of 3
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
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.

🌐
Super User
superuser.com › questions › 1738872 › how-to-detect-java-by-cmd-after-installing-it-without-restarting-the-pc-in-win
command line - How to detect java by cmd, after installing it, without restarting the PC in windows 10 - Super User
August 24, 2022 - You should check the output. Lots of breaks. In the end it does not find the patterns. Take your time. Do tests. It should work for any version of java ... I did test (with installed java) both scripts on windows 10, what return do you get when you enter reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s /f *jre* in cmd...
🌐
Reddit
reddit.com › r/javahelp › cmd does not recognize the java -version command?
r/javahelp on Reddit: CMD does not recognize the java -version command?
August 15, 2025 -

I downloaded the Java JDK 21 and JDK 8 from oracle.com and installed them in the folder C:\Program Files\Java\. I adjusted the environment variables accordingly:

  • Set JAVA_HOME as a system variable to C:\Program Files\Java\jdk-21.

  • Added the entries C:\Program Files\Java\jdk-21\bin and C:\Program Files\Java\jdk-8\bin to the Path.

I saved everything, restarted my PC, and ran CMD both normally and as an administrator. However, when I enter java -version, nothing happens – no version is displayed, and there’s no error message.

When I run where java, I get this:

  • C:\Program Files\Common Files\Oracle\Java\javapath\java.exe

  • C:\Program Files (x86)\Common Files\Oracle\Java\java8path\java.exe

  • C:\Program Files\Java\jdk-21\bin\java.exe

  • C:\Program Files\Java\jdk-8\bin\java.exe

echo %JAVA_HOME% returns C:\Program Files\Java\jdk-21 as expected.

I suspect the first two entries from where java might be leftovers from previous installations. Why doesn’t java -version work then?

Solution that worked for me:

Go to your Program Folder and deinstall eventhing that has to do with java. Search in your taskbar for java and delete everything that shows up. Clean your trash folder.

Install java again. Now it should work.

Top answer
1 of 5
2
But what's in PATH though? Remove old Java directories from this variable and keep only the right one, better to write just "${JAVA_HOME}/bin" instead of full paths
2 of 5
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
🌐
Client Portal
service.emich.edu › TDClient › 30 › Portal › KB › ArticleDet
Article - Determine Java version on W...
You can quickly determine the default installed version of Java by issuing the java -version at the Windows command prompt. ... Learn how to download and install the Applications Manager Client.
🌐
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 ...
🌐
Itview
itview.in › blog › java › how-to-check-java-version-in-cmd-a-quick-and-easy-guide
How to Check Java Version in CMD: A Quick and Easy Guide
January 23, 2025 - For Windows: Press Windows + R, type cmd, and hit Enter. This will open the Command Prompt window. Once the Command Prompt is open, type the following command: ... After typing this command, press Enter.
🌐
Edureka Community
edureka.co › home › community › categories › java › how to check java version in linux
How to check java version in linux | Edureka Community
October 27, 2023 - 258133/how-to-check-java-version-in-linux · Home · Community · Categories · Java · How to check java version in linux · how do I turn a double in an array from 1000 to infinity Jul 9, 2024 · I have created a code in java for a flower shop and now my IDE is showing all the inputs are in red showing there is an error Jul 6, 2024 ·
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check java version on windows
How to Check Java Version on Windows | Knowledge Base by phoenixNAP
December 22, 2025 - 3. Type the following command: java -version · The output displays the Java version installed on your Windows system. Conclusion · This article showed how to check the version of Java installed on a Windows system using a GUI or command prompt.
🌐
Spring
spring.io › quickstart
Spring | Quickstart
Projects created by start.spring.io contain Spring Boot , a framework that makes Spring ready to work inside your app, but without much code or configuration required. Spring Boot is the quickest and most popular way to start Spring projects. Open up the project in your IDE and locate the DemoApplication.java file in the src/main/java/com/example/demo folder.
🌐
Apache Kafka
kafka.apache.org › documentation
Documentation Redirect | Apache Kafka
May 22, 2026 - Redirecting · Security | Donate | Thanks | Events | License | Privacy
🌐
Oracle
java.com › en › download › uninstalltool.jsp
Java Uninstall Tool for macOS
» Troubleshoot Java » Instructions for Uninstalling Java » Request Uninstall Help » Other help · If you are experiencing issues while uninstalling Java, please see the Java uninstall instructions. If you are still having trouble uninstalling out-of-date versions of Java, you can request ...
🌐
Princeton CS
introcs.cs.princeton.edu › java › 15inout › windows-cmd.html
Java and the Windows Command Prompt
A missing ; or an added % is enough to screw things up. Close and re-open a command prompt. Type path at the command prompt and look for an entry that includes C:\Program Files\Java\jdk1.6.0_27\bin;. Check that the version number 1.6.0_27 matches the one you installed—Oracle updates Java periodically and you might have a more recent version.