user1681891
user1681891

Reputation: 281

Writing A Text File To A Jar

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

Answers (2)

Joop Eggen
Joop Eggen

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

John Ericksen
John Ericksen

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

Related Questions