Desktop launcher for a Vaadin Flow uberjar

I have a web application that is normally started on a desktop, but opens a web browser on that machine and is accessible normally from other machines on the LAN.

Currently it is started as a normal java -jar.

Has anyone done a kit to run in such a desktop mode but avoiding the ugly confusing console? I know about javaw but this does not give a clean way to stop things. I was thinking about (gasp) a JavaFX tiny app where the same JRE/jlink could be used.

Any other suggestions? Ah yes. Must be free.

Hi!

I would try an approach like this one. That is basically using Swing with a Spring Boot application. When you package a spring boot application properly, the jar is automatically executed if you associate the jar files to java, so with just double clicking on the jar it will be executed without opening the console log, and it should show the swing application. You could display a desktop layout telling that the application is running on the background, and you could even use the system tray to place the application like it is running on the background.

Hope it helps!

Hello @jean-francois.lamy,

Adding to Martín’s answer, I suggest looking at jpackage (official, baked into the JDK but platform specific - you can only build Windows executables from Windows, etc.). There’s also jDeploy, that makes things much easier and allows “deploying” your app to a GitHub repo or NPM, creates a nice installer and other things.

These links should give you some additional information:

jpackage apps still launch a console (I have used it, and also launch4j distributed with an innosetup installer). My main desire is to get rid of the console. I would like to terminate the jvm cleanly and run shutdown hooks, which does not happen if the user closes the console window.
jdeploy looks like an interesting path to explore.

My uberjar is not springboot-generated (I use GitHub - mvysny/vaadin-boot: Boots your Vaadin app in embedded Jetty from your main() method quickly and easily) and I use the exact same uberjar for my docker-based cloud deployments.

So for jdeploy I’d still have to figure out how to have a GUI Main as a trivial Swing or JavaFX application. I’m not sure how these GUI applications behave when their window is closed, but even if that does not grant my shutdown hook wish, the aesthetics would be better.

I still wish that since Vaadin prides itself as desktop modernization it should have a pretty launch option for running on desktops. Ideally there would be an electron-like interface for Vaadin :smiley: