I am using the java jar utility which does not supoort extracting to specific directories via command line argument. Therefore, I need to cd into the folder I want the extracted jar files to go into.

This means that I have to refer to the jar.exe file from a directory which is NOT the bin directory of Java. Whenever I try something like: "C:\Program Files\Java\jdk1.7.0_45"jar, it REFUSES to accept any arguments. The program just prints out usage information, no matter what.

I even created a .cmd file:

SET %*
"C:\Program Files\Java\jdk1.7.0_45\bin\"jar.exe %*

No dice. This is incredibly frustrating...

I've heard I can extract it like a zip file, but I'm not sure. I suppose when I rejar I'll have to use -m to use the manifest file that came with the jar.

Thanks for any help!

  • Maybe it's just a typo but..."C:\Program Files\Java\jdk1.7.0_45"jar is not valid syntax, the correct syntax is "C:\Program Files\Java\jdk1.7.0_45\jar.exe". Try it first with "C:\Program Files\Java\jdk1.7.0_45\jar.exe -foo" or "C:\Program Files\Java\jdk1.7.0_45\jar.exe" -foo (i.e. I'm not sure if the quotes should enclose the argument, so try it both ways). – Caleb Xu Jan 9 '14 at 23:37
  • @CalebXu - Quotes in the middle of the path will not harm anything. I don't recommend doing it that way, but it still should work. – dbenham Jan 10 '14 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.