You need 2 "applications":
- Minimum bootable application that checks for updates and launches the main application;
- The main application.
The user always starts the boot application, not the main application (in fact, the user does not know about the boot application). This is by far the most common pattern I've seen.
If you want to do automatic updates at runtime, you need to use OSGI as indicated by javabeats. But use this way if you really need to. I have never used OSGI, but I can imagine that this is not trivial.
Edit
I have no concrete example, but I can imagine that
- bootstrap loads some jar files and configurations
- One of the configuration files contains the files necessary in the class path (this can be done automatically by your application if it selects all jar files inside this folder).
- In the previous list, create a new class loader (see the example here ) to add jar files to the class path.
- Run the main application class in the new classloader.
Sorry, I canβt give you a more detailed answer without writing the code myself, but I take it :).
Augusto
source share