Results 1 to 5 of 5
  1. #1
    Krooger is offline Member
    Join Date
    Nov 2008
    Posts
    43
    Rep Power
    0

    Question 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.

    Many Thanks

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default

    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.

    kind regards,

    Jos

  3. #3
    Krooger is offline Member
    Join Date
    Nov 2008
    Posts
    43
    Rep Power
    0

    Default

    Sounds intresting, I'll definitely look into it, thanks for the advice!

  4. #4
    Krooger is offline Member
    Join Date
    Nov 2008
    Posts
    43
    Rep Power
    0

    Default

    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

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    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. :)

Similar Threads

  1. How to apply a patch (Call Matlab from Java)
    By Niroshan in forum Advanced Java
    Replies: 6
    Last Post: 07-09-2011, 02:55 AM
  2. Replies: 0
    Last Post: 02-11-2009, 09:53 AM
  3. Patch Application Stupidity (mine!)
    By LoTech in forum New To Java
    Replies: 5
    Last Post: 09-17-2008, 02:57 AM
  4. Replies: 7
    Last Post: 05-23-2008, 03:46 AM
  5. Need help in releasing a patch to Java application
    By venusunil in forum Advanced Java
    Replies: 1
    Last Post: 10-31-2007, 09:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •