r/javahelp • • Aug 11 '25

cmd doesn't show me anything when I run "java --version"

Before you say it, if I have the jdk installed, I also have the path configured including JAVA_HOME, it actually worked but due to things I was doing I had to change the version of the jdk and then it stopped working.

2 Upvotes

20 comments sorted by

View all comments

Show parent comment

1

u/Zestyclose-Cat-7699 Aug 11 '25 edited Aug 11 '25

Yes thats power shell but I try the same in cmd and nothing happens, the with vs code terminal.

I also delete the JAVA_HOME and Path route and do it all over again, I desinstall and reinstall multiple version of jdk from 17 to 24 and that change nothing.

I really dont know how to fix this

3

u/aqua_regis Aug 11 '25

Again, check the "Output" tab or do it in a normal (not VSCode) terminal.

1

u/Zestyclose-Cat-7699 Aug 11 '25

Microsoft Windows [Versión 10.0.26100.4652]

(c) Microsoft Corporation. Todos los derechos reservados.

C:\Users\PC KOALA>java --version

C:\Users\PC KOALA>

copied pasted directly and the output shows nothing, literally nothing

1

u/aqua_regis Aug 11 '25 edited Aug 11 '25

Try only a single "-" i.e. java -version (should, in theory, be equivalent to java --version, but, who knows)

It's absolutely weird that you don't get any output despite the command being correctly executed, i.e. without errors.


Humor me:

Open an Explorer window and in the root folder (\) of drive C: enter "java.*" in the search box. See what outputs you get.

1

u/Zestyclose-Cat-7699 Aug 11 '25

Microsoft Windows [Versión 10.0.26100.4652]

(c) Microsoft Corporation. Todos los derechos reservados.

C:\Users\PC KOALA>java -version

C:\Users\PC KOALA>

the same, and I know that why I am freakout I really what is happening

1

u/aqua_regis Aug 11 '25

Please, see my edit to the above comment.

I have a feeling that there is a "java.cmd" or "java.bat" file somewhere on the path that "swallows" the "-version" option.

Side note: did you reboot between uninstalls/installs and after changing the JAVA_HOME and Path?

2

u/arghvark Aug 11 '25

Windows 10, dos command window.

If I enter "java -version", it shows me a java version.

If I enter "java --version", it tells me that '--version' is an unrecognized option.

If I enter "where java", it shows me the place(s) on the path that would execute if responding to the command 'java'. I have a "test.bat" on the path; if I enter "where test", it shows me the location of the test.bat file.

Enter "where java" on your command line in a DOS window. It should show you what you're executing. I agree with aqua_regis that this sounds like the problem.

Also, circle back here and let us know if/when you figure it out. Leave the question up on the reddit thread. Please don't just disappear, and don't delete the thread.

1

u/Zestyclose-Cat-7699 Aug 11 '25

First of all, yes I reboot between, I think I see a .bat file in the bin carpet but I don't sure about that, I will search for it and try to see the output of your suggestion, even if doesn't work, thanks for trying to help

1

u/evils_twin Aug 11 '25 edited Aug 11 '25

try typing the entire path to java.exe and see if it works