Adding files to a jar file at runtime
I've searched google but can't find anything simple and quality.
Scenario:
There's a jar file with a bunch of classes in it. You have created new class files, and have edited a few existing ones. You want other people to be able to install these class files into THEIR jar easily, without releasing the entire new jar. So, I need an auto installer that will copy and paste/replace my class files into the jar file.
Thanks in advance for your responses.
Re: Adding files to a jar file at runtime
Without extracting and re-creating the jar file, I don't think there is another way to do this.
Re: Adding files to a jar file at runtime
In any case, 'replacing' .class files in a .jar of a running application doesn't make the new version of the class available to the application. At least, not without some very fancy class loading mechanism.
Also note that not every OS will allow you to delete and replace the .jar while an application is running.
For automatic updates when launching the application, look into using JNLP / Web Start.
db
Re: Adding files to a jar file at runtime
Normally, version upgrade is kind of packages replacement. Not a *.class file. However, you have to take care about the associations that your application has with the OS.
Re: Adding files to a jar file at runtime
Google for 'jrebel' it's a clas loader that allows live swapping of loaded classes. I think there's a free trial version.
kind regards,
Jos