4

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.

There is a general guess that seems to be right that is I might have the PATH environment variable incorrectly. But I have already done this, I added the following value to PATH variable : 'C:\Program Files(x86)\Java\jdk1.8.0_25\bin'.

I am running a 64 bit windows 8 system. I have also referenced this question from the following link: java 'jar' is not recognized as an internal or external command

I have also tried some of the solutions suggested in the above link, I couldnt add a comment there since my reputation is not much.

Suggestions that I have tried from the above link:

[1]https://stackoverflow.com/a/29180681/7639034

(From the above link, java -version and java -jar are also working. What is wrong with the jar file then?)

[2]https://stackoverflow.com/a/42492380/7639034

Community
  • 1
  • 1
Code_Ninja
  • 1,729
  • 1
  • 14
  • 38

2 Answers2

9

Path variable should be pointing to bin folder, that's where executable are stored. Currently you are having path only upto C:\Program Files(x86)\Java\jdk1.8.0_25 so you are getting error.

Create JAVA_HOME environment variable which points to above location, and add %JAVA_HOME%\bin to PATH variable. It will work.

Pradeep Simha
  • 17,683
  • 18
  • 56
  • 107
-2

try

java -jar [YOURJAR]

this should work to execute jars

Nadav Tasher
  • 147
  • 6
  • I want to create an 'executable jar' from the 'manifest.mf' file. For that i need to execute `jar` command but its not working. – Code_Ninja Apr 20 '17 at 08:59