TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Using Java 9 Modularization to Ship Zero-Dependency Apps

332 pointsby lfischerover 7 years ago

17 comments

freedombenover 7 years ago
This is definitely an improvement for Java, but it leaves me with a few thoughts as someone who has done Java professionally at times, but also professionally lived in other ecosystems including C++&#x2F;Qt, Python, Ruby, Golang, and of course node&#x2F;JS.<p>1. Setting up a project is still a pain in the butt. Tools like Gradle are a nice improvement over Ant (and some would say maven), but still most people don&#x27;t even understand them. You have some serious reading ahead of you if you want to set something up that isn&#x27;t already templated somewhere for you. You can lean on an IDE for sure, and for most Java devs this is probably a no-brainer. I&#x27;m weird in that I don&#x27;t like magic. I prefer to know what the tool is doing on my behalf, and the Java IDE world is so complex that it isn&#x27;t practical to learn that unless you&#x27;re in the ecosystem for years. Then dealing with weird exceptions from the JVM can be maddening.<p>2. The Java world moves slowly. It could reasonably be years before many shops transition to Java 9, when you would actually realize the benefits of this in your work life.<p>3. So much Java runs on the server side anyway, where executable size and entrypoint doesn&#x27;t really matter that much. Because of this, it may only be a small subset of Java shops that really get into Java 9&#x2F;Jigsaw and iron out the bugs, and create tools&#x2F;tutorials for others.
评论 #16059102 未加载
评论 #16056770 未加载
评论 #16058930 未加载
评论 #16055895 未加载
评论 #16056007 未加载
评论 #16058753 未加载
评论 #16055730 未加载
评论 #16059772 未加载
评论 #16056127 未加载
评论 #16057066 未加载
评论 #16057210 未加载
评论 #16055733 未加载
评论 #16071910 未加载
评论 #16079552 未加载
评论 #16057898 未加载
评论 #16056884 未加载
jcdavisover 7 years ago
Is worth mentioning that SubstrateVM (<a href="https:&#x2F;&#x2F;github.com&#x2F;graalvm&#x2F;graal&#x2F;tree&#x2F;master&#x2F;substratevm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;graalvm&#x2F;graal&#x2F;tree&#x2F;master&#x2F;substratevm</a>) is now open source, which does whole-world AOT compilation to produce a single executable or shared library. It does have substantial limitations (eg no runtime class generation&#x2F;loading), so it might not be suitable for every project
评论 #16056086 未加载
评论 #16057147 未加载
dullgiulioover 7 years ago
The author misses the point when he says this might help Java regain share in the space of DevOps tools which is currently mostly Go.<p>The problem is not artifact size but the JVM slow start-up time. This is made worse by almost all Java frameworks that by definition do all their own stuff before passing control to your real app code.<p>Such executables are not something you would put in a loop in a shell one liner, and that is the space for command line utilities Go has occupied successfully.
评论 #16056929 未加载
评论 #16058165 未加载
评论 #16057502 未加载
评论 #16057769 未加载
评论 #16059074 未加载
评论 #16060405 未加载
digitalsanctumover 7 years ago
I&#x27;ve recently become much more interested in Kotlin to provide true native apps. The trade-off is that the native bits are still pretty green.
评论 #16055845 未加载
nine_kover 7 years ago
Now combine it with JavaFX and we can have reasonably-sized cross-platform GUI apps again.<p>Yes, you can compile a QT or a GTK app for every platform, and use e.g. Python or Go to write the cross-platform part + package it into a single file. It&#x27;s still as many files as you have platforms.
评论 #16055768 未加载
评论 #16055979 未加载
评论 #16055784 未加载
drraid0over 7 years ago
Are the installers for such &quot;native&quot; apps going to ask me to install an Ask.com toolbar?
评论 #16056782 未加载
malkiaover 7 years ago
How are .so, .dll files handled during Java packing? This is more open question, but say you have one &quot;.exe&quot; file. Now you need to extract the DLL in a place, and make sure everytime it&#x27;s the right one (gets tricky if the tool is ran simualtnenously, like spawned from a build process).<p>While I was at Google, instead of having multiple .so files, the main launcher was a C++ binary, and all external C++ dependencies were linked into it (that&#x27;s it if you have the source code), then you didn&#x27;t need that.<p>I guess now it&#x27;s up to the BUILD system to achieve that, where if you have more flexible BUILD language you can instruct everything to go in the main launcher file, then have all the .jars into one, slapped at the end of the file.<p>At the end, ship or update only one binary to your service, desktop machine, etc.
评论 #16055713 未加载
评论 #16059108 未加载
评论 #16059116 未加载
Eccoover 7 years ago
I love how the article shows an 11 MB Hello World as &quot;stripped down&quot; 2x improvement :-)
评论 #16055598 未加载
评论 #16055590 未加载
评论 #16055813 未加载
评论 #16055836 未加载
评论 #16058003 未加载
malkiaover 7 years ago
This would be great for BUILD tools like bazel which is written in Java.
评论 #16055892 未加载
e12eover 7 years ago
Previous discussion:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=15521611" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=15521611</a>
stevefan1999over 7 years ago
I reckon Mono had offered the same thing, although it bundles the entire mscorlib...
fulafelover 7 years ago
Does this affect Clojure? If so, how?
评论 #16060437 未加载
alfanickover 7 years ago
&gt; Using Java 9 Modularization to Ship Zero-Dependency <i>Native Apps</i><p>&gt; [...]<p>&gt; and superior to web-hybrid options like Electron<p>How is Java or Electron (JavaScript+WebKit) considered <i>native</i> nowadays?<p>Please use native APIs, so my laptop can actually hold 10h load on battery.<p>edit: can we remove <i>native</i> from the title?
评论 #16056745 未加载
评论 #16056356 未加载
adamzegelinover 7 years ago
Dunno if I&#x27;d call Java <i>native</i>. This is more like zero-dependecy Java apps — aka, you don&#x27;t need to pre-install the JVM (and its &quot;optional&quot; adware on Windows).
评论 #16055616 未加载
评论 #16058022 未加载
LoSboccaccover 7 years ago
but why gradle?
评论 #16055578 未加载
iamleppertover 7 years ago
&quot;and superior to web-hybrid options like Electron&quot;<p>Superior exactly in what way? Electron allows access to an enormous audience of developers and the web ecosystem. You really can&#x27;t compete with that and would be silly to try at this point.
评论 #16056107 未加载
评论 #16056105 未加载
评论 #16056436 未加载
sillysaurus3over 7 years ago
Anyone notice that Java is suddenly cool thanks to Kotlin?<p>I haven&#x27;t done much more than dabble, but it was an enjoyable dabble. Unlike vanilla Java.<p>It even compiles to JS with a relatively small-ish runtime. It&#x27;s big enough to cause problems embedding it, but it&#x27;s small enough to be workable.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;JetBrains&#x2F;create-react-kotlin-app" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;JetBrains&#x2F;create-react-kotlin-app</a>