Reputation: 9856
Do you know a python module with which i can add files to a JAR archive?
(what i wan't to do is add .class files to a jar archive)
and the program that has to do it has to be written in python
Thanks!
Upvotes: 6
Views: 2857
Reputation: 18580
This can be done with subprocess calling the jar command:
import subprocess
def add_to_jar(file2add, jar_file):
cmd = 'jar -uf ' + jar_file + " " + file2add
proc = subprocess.Popen(cmd, shell=True)
add_to_jar(file_to_add, jar_file)
Upvotes: 0
Reputation: 42757
.jar files are just .zip files with a different file extension and a manifest.
Try http://docs.python.org/library/zipfile.html
Upvotes: 10