"java -version"in cmd gives no result
Asked Answered
I

2

7

I tried to install java 14 manually on Windows 10. I set the System Variables as in this picture.

But when I use the command "java -version" literally nothing happens...

C:\WINDOWS\system32>java -version

C:\WINDOWS\system32>

Something must be wrong, but I can't figure what...

Imminence answered 17/12, 2020 at 16:9 Comment(5)
You have both, some generic java ("....Oracle\Java\javapath") and the JDK in your PATH variable. Try to use only the JDK.Moribund
.. Or set the bin in PATH before the other one.Akmolinsk
Damn both of that worked, Thanks!Imminence
have similar issue RESOLVE IT by writing in cmd "where java" and realize been decelerated twice in environment variables –Savage
Take also a look at JAVA command shows nothing in a command promptTillo
F
19
  1. Move C:\Program Files\Java\jdk-14.0.2\bin\java to the beginning in the PATH variable.
  2. Important - Open a new cmd window and use the command java -version. Any already open cmd windows do not reflect the settings that you do in the environment variables form/window.
Farthingale answered 17/12, 2020 at 16:26 Comment(0)
F
12

Solution

Please first run the following command

"c:\Program Files\Java\jdk-14.0.2\bin\java" --version

If that returns a result remove the following entries from your PATH

c:\Program Files\Common Files\Oracle\Java\javapath
c:\Program Files\Java\jdk-14.0.2\bin\java\bin

Then create an environment variable called JAVA and set it to %JAVA_HOME%\bin, then simply add %JAVA% to your PATH variable.

You will need to close your command prompt window and reopen it before the change will take effect

Fastening answered 17/12, 2020 at 16:20 Comment(2)
Worked for me. I also had "...\Oracle\Java\javapath" in my PATH. Removing it from there solved it.Colobus
what to do if "c:\Program Files\Java\jdk-14.0.2\bin\java" --version doesn't return any result ?Calculable

© 2022 - 2024 — McMap. All rights reserved.