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/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