r/programming • • Oct 21 '17

Using Java 9 Modularization to Ship Zero-Dependency Native Apps

https://steveperkins.com/using-java-9-modularization-to-ship-zero-dependency-native-apps#.Wes5IMWbUWE.reddit
310 Upvotes

109 comments sorted by

View all comments

20

u/Sloshy42 Oct 21 '17

It would be really super nice to be able to develop a desktop app in Java, bundling my own JVM, and publish it knowing that it would work pretty much anywhere like that. I have to wonder, though, would having multiple instances of the JVM on a user's machine not use up a lot more memory? Wouldn't this just be another Electron-esque situation all over again (albeit more efficient in some circumstances)?

21

u/BadMoonRosin Oct 21 '17

Good question. I'm working on a follow-up article specifically about JavaFX as an alternative to Electron (and Qt or GTK for that matter).

In terms of disk size, I can already tell you that a modularized JavaFX app is a small fraction of an equivalent Electron app. Given how many resources the Slack client devours on my laptop, I'm pretty optimistic about how the memory profiling tests will go, too. I'm not sure what to expect in comparing startup times.

Regardless, having dabbled with a bit of Electron development, and it's weird Frankenstein model of bridging between the browser code and the Node.js code... I have no doubt that JavaFX offers better developer ergonomics and cleaner design.

5

u/[deleted] Oct 21 '17 edited Oct 21 '17

I just started using Java FX and I really like it for desktop UIs, however it's terrible for game dev (I tried to implement the X-Com 2 UI in Java FX and realised it can't do it; interestingly their UI is some basic primitives from Unreal engine, and Flash for animation). And there's some things missing from the JavaFX API, like the ability to make a table auto-resize its columns.

Why would you use it for games though? Well you wouldn't but they seem to think you should judging by some of their marketing and examples.

The one good thing electron has going for it is that you can live edit, but that's a slightly dubious advantage, since it's something you should leave to the designer.

Personally I am not too worried about file size since I found out that most app stores don't charge you for bandwidth ;-)

3

u/jl2352 Oct 22 '17

The one good thing electron has going for it is that you can live edit, but that's a slightly dubious advantage, since it's something you should leave to the designer.

I'm not sure if you mean being able to debug and alter the UI, or hot reloading. Both are invaluable for front end developers.