Fork me on GitHub

Is there a good process for automatic updates? @vlaaad Taking a look it seems that jpackage doesn't offer this out of the box. I found update4j which seems like it might be a solution but have to dig further on that.


Hi! Afaik, there is no good process for automatic updates. On the JVM level. When I was working on Defold editor (clj desktop app), we had to implement it ourselves. It also had some issues with overwriting files on Windows which is not allowed by os if it's executed


@grounded_sage You can jpackage a clj tool instead of your actual app and make it lookup latest release and download + run it :D


By clj tool I basically mean tools.deps library :)


Okay. Yea I guess that is a solution. Don't like it but don’t really see many if any options otherwise.


Using tools-deps on a client is actually sorta kinda like browsers lookup/cache web app resources

👍 1

To dig a bit deeper on this for my comprehension. Do you mean being able to reference the source and build on the client or fetch the Jar/s. Or both. I'm not really sure yet what the different trade offs would be here. With payload size, client side compute, security.


btw I've been thinking about using tools.deps a bit and I think there might be a problem with this approach, though it might be possible to side-step it — tools.deps uses systemwide git for git deps, end users might not have it


I was thinking about fetching jars


more specifically, lightweight jars instead of uberjars


and tools-deps on end-user machine resolves all deps and caches them


Good point on the git. @skynet shared some code that does the Jar fetching.;channel=CGHHJNENB&amp;message_ts=1642196059.014600 Also mentioned it could be a library and I do think that would be valuable. At the very least a dedicated public repo would be a good way to aggregate some discussion and implementations on the best way to handle this.


I’ve thought about it for a bit more and I see another downside — you can’t update the JDK


that reminded me that we struggled with this in Defold where we needed to update the JDK — on Windows the OS held some files open and that disallowed overwriting them, so we had to install JDKs in different locations…


ah yes updating the JDK is another thing to consider.


This is what Electron is using it seems. I'm currently digging around to see if it's a viable solution.


I'm wondering if it's possible to do a GraalVM native binary which can be the installer. Was reading that JavaFX doesn't play nice with it but Gluon has it working.. we could then have a minimal custom UI and then handle installing the JRE and .jar separately.


Rereading what you said before... you managed to solve the JDK updates at Defold?


that's the updater code, but every auto-updated system is 2 parts — client that downloads and release process... it's also there, but it's python, and deals with internal setup and aws and stuff


Of course with the downside that it requires internet connection to start it the first time


I find this an acceptable trade off


Yea at the moment I have to build the jar file and also call on jpackage for the distributions. But going to have to rethink how I structure it because automatic updates is preferable.


you can do auto updates even when using jpackage by replacing the .jar file. if you need to replace it somewhere that has special permissions on Windows you can use something like


Do you know any example projects in the wild that do this? @skynet I’ve done a bit of searching but at the moment think I'll just end up doing a bit of hacking next week. I come from more js environment so this whole environment is new to me


I do it in a project here with some helper fns here this works on Windows using the normal jpackage install run by .exe, but can also be used if running from a .jar

🙏 1

You've saved me hours of frustration. I'll be diving into the code deeper next week. Thank you.


no problem, let me know if you have any issues. maybe there should be a library that does this kind of thing


Oh yea. I do think this would be a valuable library.


My thinking is definitely leaning towards having a minimal install updated shell and then just swapping out the jar for the remainder of the application