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 Overflowyou 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.
You need to update your Windows path to include your %JAVA_HOME%\bin directory. %JAVA_HOME% is the directory that you installed Java into and is also an environment variable that you need to configure for command line execution of your applications. You can edit both of these in the Windows control panel and you should restart.
When you run java -version you will see the internal version number. This is explained here: https://en.wikipedia.org/wiki/Java_version_history.
Basically, you can ignore the 1. when reading version number. The _xxx is a reference to the most recent patch or build release.
CMD shows nothing when putting 'java -version'
CMD does not recognize the java -version command?
Check Java version from Command Line
How can I see all installed Java versions?
Videos
Change your PATH variable so that it has the location of the jdk5/bin directory:
- Start -> Control Panel -> System -> Advanced
- Click on Environment Variables, under System Variables, find PATH, and click on it.
- In the Edit windows, modify PATH by adding the location of your jdk5/bin directory to the beginning. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the directory as the value.
- Close the window.
- Reopen Command prompt window, and run
java -version
In the command shell:
set JAVA_HOME=C:\jdk1.6.0u24
set PATH=%JAVA_HOME%\bin;%PATH%
That will temporarily set up the environment in the command shell. Maven, Ant, etc. will pick up on your new version of Java without having to go to the Control Panel repeatedly.
Tools like Eclipse should be able to select which JDK to use in their own configuration tools for use within their environments.
Hi,i have been having problems with java, so i started to investigate if java was working properly.
When executing the command, i don't get anything, i have searched and i can't find anything, only solutions when it appears that the command is not recognized, but nothing comes up for me.
http://prntscr.com/26vq5jv
Anyone knows the solution?
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.
I have a Java installation and I have only access via bash. How can I check the Java version from command line.
This should work. This assumes it’s installed in a directory that’s included in $PATH which isn’t always the case with Java. Some programs ship with their own version of Java specific to their application so you’ll first have to determine where it’s installed.
java --version