Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a jar, and I need to replace a class in it, at this moment, I can only open it with "archive manager" and then drag and drop the new compiled class into the jar, but I think this is really boring, if I can do with with just a command ?

Thanks ~

share|improve this question
    
+1 for gui being boring :), but you should correct "archive manager"... –  Johan Oct 18 '10 at 5:45
add comment

2 Answers

up vote 3 down vote accepted
zip -u stuff.jar file.txt

will update file.txt in stuff.zip . Note that for -u file.txt must already exist in the zip file, and will only be overwritten if it's newer than the one in the jar.

share|improve this answer
    
great tip. you could probably do it with 7-zip also. –  djangofan Oct 18 '10 at 5:03
add comment

what about this one

jar -uf YOURJAR.jar FILE

if the jar have a folder structure, you can keep that too

jar -uf YOURJAR.jar DIR/DIR/FILE

Look this one for more information http://docs.oracle.com/javase/tutorial/deployment/jar/update.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.