Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically update jar files

I am currently working on desktop software based on java.It's quite a big code base (more than 40 jar files).

I wish to provide an automatic update functionality. The desktop software constantly checks one back end system to see if there are new versions of the jar files available.

The problem now is: How to replace the updated jar files?

like image 839
user381878 Avatar asked Aug 23 '10 06:08

user381878


2 Answers

If you deploy your application using Java Webstart (JNLP), you get this mechanism almost for free...

From http://mindprod.com/jgloss/javawebstart.html

The key benefit for Java Web Start is automatic update without having to download the entire program every time.

like image 158
aioobe Avatar answered Dec 12 '22 23:12

aioobe


  • Easiest would be to check for updates on each startup, download the updates and then launch your application. I think this is the way that Java Web Start works (see aioobes answer).

  • More complex would be to use either the netbeans or eclipse framework for your application. Both are rather complex and you will have to rewrite your application to work with them. This solution supports live updates.

As far as I am aware there is no easy way to update a running application. It is possible to load new versions of a class with a different classloader, but not possible to unload old versions while they are still referenced.

like image 22
josefx Avatar answered Dec 12 '22 23:12

josefx