tags:

views:

701

answers:

1

using jar on the windows command prompt, how can I add foo.class to a folder "classes" in foo.jar?

I can add the file to the jar using

jar uvf foo.jar foo.class

but that doesn't put the class in the "classes" folder in the jar.

I know I can use winzip to unzip the jar, add the file, and zip it up again, but that's slow and hopefully unnecessary.

+5  A: 

Put foo.class into a classes directory, then run

jar uvf foo.jar classes/foo.class

(I've just tried it to make sure it works. There may a way of doing it without creating the classes directory, but I think this is the simplest solution.)

Jon Skeet