How to Patch a jar file?
Hello, so this is completely foreign material for me. What I am wanting to do is create a program, make a jar along with other support files and then distribute this software. I then want to be able to have this program check if I have a new version available then update itself.
For support files I imagine I would just download the new files and then delete any old files if I have to, that shouldnt be a problem. The thing I have no idea is how to update the jar file. Lets say I add a new feature to my program and I want everyone who is using it to have that new feature without having to download my distribution again, how would I go about doing this?
When I try to find stuff about patching on the net I seem to always just find patching related to repositorys. Can someone point me in the right direction about patching a program? I dont even know where to begin.
Google for "Java Rebel"; basically it's a classloader that allows classes to be "hot swapped" when their file image changed. All you have to do is change your .jar file and your running application notices the change and reloads the classes that were already loaded (with the old version). It's a quite nifty piece of software.
Sounds intresting, I'll definitely look into it, thanks for the advice!
Java rebel is pretty neat but I don't think it does what I require.
Suppose i make a minor change to the code to add a feature. Java rebel does a really good job of reloading that class for me as I develope it but that works because I have the source on my computer. My problem is applying this change to the clients already built jar file.
Im thinking maybe have a bootstrap jar file that is the main jar file you load, then that checks if there is an update and it will transfer the new jar from the server to their computer and then load it afterwards. This way the client dosent have to keep checking for updates and the bootstrap shouldnt need to change ever. Anyone ever done anything like this? I guess its kind of like applications that have splash screens that have update and launch options
Have a look at Eclipse or maybe Netbeans. They must do something similar, though after an update they do require a restart. I was pondering this sort of thing earlier this year and thought, as you have, about some sort of bootstrap thing...but I never got further than pondering. :)