java 'jar' is not recognized as an internal or external command
Solution 1
The path should only contain directories where the OS will look for executables. Strip the trailing "\jar.exe" to set your path as:
(old path variables here);C:\Program Files (x86)\Java\jdk1.7\bin
Thanks To : @stevevls
Solution 2
Try using this command:
java -version
If it doesn't work that means you failed to properly add path to jdk. If it does work, try using:
java -jar
Solution 3
The jar command in command line is used in order to create a JAR file. For example:
jar cf jar-file input-file(s)
See more at: Oracle docs
If you want to run the existed JAR file you should use the java -jar command mentioned by @Aleksandr.
But in your case it looks like you don't have an access to the added directory in your path with JKD binaries so at the beginning try to execute mentioned java --version to check whether you have java in you classpath at all.
Please remember that on Windows you have to restart the console when you change the windows default path. You do not see the changes on the current console.
The x64 version of Java is installed on Program Files. The x86 version is installed on Program Files x86 by default.
Solution 4
Five steps to solve this problem:
- check whether in your
bin
folder jar.exe is availbale or not - check for your environmental setting
- download jar file from here http://originaldll.com/file/jar.exe/29248.html and keep in
bin
folder - now check for jar it will 100% work
- keep any jar in your desktop and go to desktop path on cmd prompt and run the command
jar xf filename.jar
Now see if it is working
Coder Lam
Updated on August 16, 2022Comments
-
Coder Lam over 1 year
I'm getting the following error when I try to run the 'jar' command in the command line on windows : 'jar' is not recognized as an internal or external command
The general solution seems to be that I need to add the jdk bin folder to the PATH in environment variables. I have already done this, I added the following to the path variable : ...; C:\Program Files\Java\jdk1.8.0_40\bin\;
Though I'm not sure if having the jdk reside in 'program files' instead of 'program files x86' affects this. I'm on 64 bit windows with 64 bit java. Thanks