Programmers learn & share
0 votes

Problem :

I get the following error when I execute jar command in cmd.

'jar' is not recognized as an internal or external command, operable program or batch file.                       

I tried very hard to solve this problem by myself by putting the path of the jar.exe file in my "path" variable in My computer > > settings > advanced system settings > environment variables.

This is how i tried to fix my issue -

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

I properly saved all the changes and also tried to run jar in cmd prompt again and but I got the same error. 

Please let me know my mistake and how to fix it. I need to create jar files via the command line.

by (6.9k points)   | 63 views

2 Answers

0 votes

Solution :

Following are the steps to solve this issue:

1.      Please check in your bin folder if  jar.exe is available or not

2.      Also look for your environmental settings

3.      Please download jar file from here and keep it in your bin folder

4.      now please check for jar it will 100% work

5.      Please note you need to keep any jar in your desktop and go to desktop path on cmd prompt and run the command jar xf filename.jar

6.      Now it will work.

by (36.1k points)  
0 votes

There are many reasons for encountering this error. Here we will discuss some solutions;

Solution 1:

  • The path that is provided by the user should only contain directories where the operating system can look for executable. First check your bin folder jar.exe is available or not. Strip the “\jar.exe” to set your path as;
(old path variables);C:\Program Files (x86)\java\jdk1.7\bin
  • Check for your environment variable settings.
  • Download the jar file from the following link and keep it in the bin folder;
  • Now check whether the jar is working 100% or not.
  • Keep any jar file in your desktop and go to the desktop path by using the cmd command prompt and the run the command;
jar xf filename.jar

Now see I hope it is working.

Solution 2:

If you cannot able to solve your error from the above method then use this one;

  • Create shortcut for C:\Program Files (x86)\Java\jdk1.7\bin\java.exe.
  • Open the C:\ProgramData\Oracle\Java\javapath. You can copy the address to file explorer or you can set it to show the hidden files.
  • Copy previously created a shortcut to the java path folder, by replacing the existing one. Make sure it named exactly java.exe.


ago by (3.2k points)  
2,245 questions
2,807 answers
241 users