Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error - jar is not recognized as an internal or external command, operable program or batch file

Tags:

java

jar

I get the error mentioned above when I execute jar command in cmd. I tried to solve this problem by going putting the path of the jar.exe file in the "path" variable in My computer> > settings > advanced system settings > environment variables.

This is how i did it -

(old path variables here);C:\Program Files (x86)\Java\jdk1.7\bin\jar.exe 

I saved the changes and tried to run jar in cmd again and got the same error. Please tell me my mistake and how to fix it. I need to make this work so that I can create jar files via the command line.

like image 434
Apple Grinder Avatar asked Nov 28 '12 23:11

Apple Grinder


People also ask

How do I fix a JAR file that won't open?

1 -Right click on the jar file and click on Open with and then click on choose another app. 5 – Select java.exe and click OK. If all of the above methods fail, search for jarfix program on Google and download it. This will instantly fix the issue.

Why JAR file is not recognized?

If you do not have Java installed, and the PATH variable is not set correctly, attempts to run a JAR file on Windows or Ubuntu will result in a 'Java not recognized' error. To run a JAR file, you must install the Java JDK or JRE on your computer.

How do I run a .jar executable?

Double-click the JAR file. If it's executable and you have Java installed, it should open. If it doesn't open, proceed to the next step. You may see a pop-up window asking which program you want to use to open the file. If so, click Java(TM) and then click OK.


1 Answers

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
like image 177
stevevls Avatar answered Sep 18 '22 14:09

stevevls