Tuesday, March 22, 2011

Notes on Integration: modifying JAR files

Notes on Integration: modifying JAR files: "What you need to do is use the JAR utility that comes with JDK. This way you can insert you class file and create a new JAR that your application can pick up.

1) use the following command to 'unzip' or expand your jar:

> jar xf .jar

This will cause the contents of the JAr to be extracted in the current directory.

2) Make your changes .. replace class file.. whatever.

3) use the following command to 'zip' or create your new jar:

jar cf jar-file input-file(s)/folder

Of course, the Sun site has detailed information.

You could also use the u parameter to update only the files you need.
jar -uf .jar"

No comments:

Post a Comment