Reputation: 281
I'm writing a program which 'builds' another. I plan to save the settings insite the generated jar file, but am having some trouble with writing to an external jar. Any help is appreciated.
Upvotes: 0
Views: 104
Reputation: 109547
A better solution would be to create a second jar, and write your own ClassLoader to load classes from that jar. A kind of plugin mechanism.
Upvotes: 0
Reputation: 11113
A jar is just a zip file so all you have to do is zip up your files and name the zip with a .jar extension.
One handy library to create jar archives is Shrinkwrap which allows you to put classes, resources, etc into jar files using a Java API
Upvotes: 2