Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade jpackage Application without running another installer?

After a jpackage application has been installed, how can I allow my users to upgrade the application without requiring them to run the installer all over again? What options do I have to allow users to upgrade?

An ideal scenario is that the underlying jars would be swapped out at runtime, and the application would be restarted in the same process. I imagine this probably isn't possible though?

like image 551
spierce7 Avatar asked Nov 07 '20 19:11

spierce7


People also ask

How do I use jpackage tool?

See jpackage Options. The jpackage tool will take as input a Java application and a Java run-time image, and produce a Java application image that includes all the necessary dependencies. It will be able to produce a native package in a platform-specific format, such as an exe on Windows or a dmg on macOS.

Can I build non-modular apps with jpackage?

Though jpackage only supports JDK11+, you can still build traditional non-modular apps. This is the simplest example to demonstrate how jpackage works. You take an executable jar file, in this case myapp.jar, and specify the class inside that you want to execute.

Why can't I download the packages I Need?

The dependencies (i.e., the other packages that a package needs to install or work) themselves may have dependencies that you don't already have installed. Once you know what packages you need, you can download them. I suggest using Launchpad for this, because the downloads are SSL-encrypted, which helps prevent file corruption.

How do I create a custom runtime image with jpackage?

If you already have a runtime image with the modules in it, you can simply tell jpackage to use the runtime image you want with the --runtime-image option. Specify the main class with the --module option. To learn how to create a custom runtime, check out my tutorial How to Create Java Runtime Images with jlink.


1 Answers

jpackage doesn't currently support auto update although they are planning to support it in future I think.

Until then, you can use this java library:

https://github.com/threerings/getdown

like image 117
Saeid Nourian Avatar answered Oct 22 '22 09:10

Saeid Nourian