How to get java command running?



When working with any command line (windows-cmd, git bash, ..), no Java commands are working.

I executed java -version and nothing happens. I can type again.

I have set my JAVA_HOME variable to C:/Users/myName/Java/jdk1.8

and I have also added %JAVA_HOME%\bin to my Path variable.

It’s not, that the command does not get recognised. It’s just that nothing happens.
I could probably run the java.exe command directly, but I wanna fix the env variable.

Can someone help?

Best regards

enter image description here


Try this (Windows):

  1. Locate your JDK/JRE binary – Usually the path for your JDK/JRE bin (On Windows) is:

    Your OS Drive(C or D etc):\Program Files\Java\jdk[version]\bin. After you’ve located it, Copy your path to your clipboard.

  2. Search for "Environment Variables" on windows.

  3. Create a new User variable name it (usually named "JAVA_HOME") and copy your path as a value.

    enter image description here

    Now in System variables locate a variable named "Path" and add the same value set in JAVA_HOME.

  4. Close and then reopen the CMD.

If this solution does not work, reinstall java. You can uninstall through:

Control Panel -> Programs -> Under Programs and Features -> Uninstall a program.

Answered By – InSaNiTy

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More