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

Show parent comments

77

u/SizzlingVortex Oct 21 '17

From the article, I think the author describes native as:

  • Being able to bundle the JVM (versus having the user install Java separately)

  • Not having to embed a web browser like, for example, Electron -- which is called a web-hybrid app in the article

68

u/BadMoonRosin Oct 21 '17 edited Oct 21 '17

Yup... it's a good discussion topic, and I definitely wrestled with the phrasing. Having studied Pascal back in university, and starting out my career as a C++ dev, I too have always thought of "native" as being "a standalone executable".

However, I would run into issues when playing with cross-platform GUI libraries such as wxWidgets, GTK, or Qt. I always wanted to compile my apps down to a statically linked, standalone executable. I didn't want to have to ship a bunch of shared libs, or depend on them being present on the target machines! Yet more knowledgeable developers would calmly try to explain to me that dynamic linking is often technically superior (or with Qt, necessary due to licensing).

Also, last year I went to a Java conference and sat through a few sessions on profiling and JVM tuning. It was a lightbulb moment, that left me considering the possibility that a runtime VM with a JIT compiler really IS a technically superior approach over full AOT compilation.

So anyway, if you're having to ship to tens of megs of dynamically linked libraries with your "native" app... then is it really THAT far removed from an app that's linked to an embedded runtime? I'm not so sure. And I would strongly argue that you have no less claim to the "native" label than Electron has.

43

u/doom_Oo7 Oct 21 '17

Native == the executable you run is a sequence of ASM instructions for your cpu / os without run-time interpretation of algorithms or code necessary for your software's execution.

Also, you can link Qt (and any lgpl stuff actually) statically, as long as you provide object files (not source) upon request.

24

u/[deleted] Oct 21 '17

I would say that is native code.

However we often talk about other aspects of "nativeness" such as having a native looking gui, or working in the appstore, and an end-user might consider those 2 as important.

Although I do agree with you, that I'm unhappy with how the OP has defined native.