Timm - 2017-10-23

I have a JavaFx application, let's call it MyApp, with a bundled JRE (placed as a subfolder in the application directory) and the application starter MyApp.exe build with Launch4j.

At startup the application checks if a new version is available and then auto loads changed jar files from an update server into a new folder (and copies all unchanged jar files from the previous version folder). The launch4j ini file is updated accordingy with the new directory as the classpath:
-cp "libs/1.1.275/*"

This is very simple to maintain, works great, and is rolled out to many users. The problem comes if I want to update the bundled JRE, because now I can't just rewrite the ini file at the end of the update to rewire everything. Since the jre path is coded in the MyApp.exe, I need to update it as well, and that's where trouble starts in many forms (incapabiltiy to overwrite started exe files in windows, overwriting launcher file can destroy shortcuts, some types of virus software see this as a red flag, and further technical and architectural reasons). While there are workarounds for most of this, any such solution becomes not simple, but complex and thus fragile.

Long story short, I don't want to update the MyApp.exe ever. But to achieve that I need to have the bundled jre path configurable at startup instead of configuring it with <jre> <path> during creation of the MyApp.exe by launch4j.

I looked a little into the code and I guess if I'd want to change this I'd need to modify the file head.c and add a function to parse a custom ini file which contains the jre path and then overwrite the internally wired one with that.

Is there any other way to do this that I may be unaware of?

 

Last edit: Timm 2017-10-23