my problem is that I want to add some .class files from a normal directory into an .jar file. Do I have to extract it before or can I add the files “on the fly”?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If it was me I would almost certainly just call the
jarcommand within Ruby to do this:Reference here.
If you still want to do this without calling
jaryou should be able to do it with rubyzip, since JAR files are just ZIP files with a particular structure. Something like this:There are also a few Ruby wrappers for libarchive that could do this. E.g.