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.

Distribution of JVM Desktop Applications

133 pointsby nfrankelover 4 years ago

16 comments

pronover 4 years ago
&gt; Java Web Start. This is the canonical way for desktop applications.<p>Not anymore. Java Web Start was removed because the very concept of a JRE, a system-wide runtime downloaded directly from Oracle and managed by the user or their IT department, no longer exists (despite some OpenJDK distributions offering something they call a JRE -- perhaps to maintain a sense of familiarity -- no one actually provides a JRE anymore, although I guess OpenWebStart is attempting to resurrect it). Like any other application, Java applications now only have two parties: the user and the application&#x27;s vendor. It is the responsibility of the vendor to deliver the application along with any dependency, including a Java runtime. The vendor may choose to supply their own automatic update mechanism, for the application <i>and</i> the runtime, but users need not interact directly with the Java runtime anymore.<p>Web Start, like Applets, was entirely predicated on the notion of the JRE. With the latter gone, the former is meaningless.<p>Why was the JRE discontinued?<p>1. The software ecosystem now discourages system-wide third-party runtimes. On the desktop, the app store model rules; on the server, containers are popular -- both are much more friendly to an embedded runtime.<p>2. An embedded runtime with jlink gives the user a better experience by giving the software vendor full responsibility over their software and not requiring the user to deal with runtime components they don&#x27;t, and need not, understand (although, admittedly, popular Java build tools currently lag in their support for jlink). In other words, the new way is better, but it does require getting used to.<p>&gt; While it can in theory work with any application, it shines with modularized applications.<p>Not just in theory. jlink is <i>the</i> recommended practice for deploying any Java application, desktop or server, modular or not. While a modular application can help automate more steps of the packaging process (like not requiring running jdeps to find dependencies and automatically generating launcher scripts), jlink is not especially tied to modular applications. It is how <i>all</i> Java applications should be distributed (jpackage internally uses jlink).<p>(I work at Oracle on OpenJDK)
评论 #26138328 未加载
评论 #26136460 未加载
评论 #26139258 未加载
评论 #26138011 未加载
评论 #26137670 未加载
评论 #26140128 未加载
评论 #26137266 未加载
评论 #26136516 未加载
评论 #26140972 未加载
评论 #26140362 未加载
评论 #26137037 未加载
c-smileover 4 years ago
1. Create minimal JVM and runtime with GUI primitives and compile it into .EXE<p>2. Create packager that concats class files (in JAR) of your application with that EXE.<p>3. Sign the exe. That&#x27;s your monolithic application without external dependencies.<p>Done. You can distribute your Java applications without any need for JRE, WebStart or anything like that.<p>Did that once as J-SMILE (<a href="https:&#x2F;&#x2F;terrainformatica.com&#x2F;org&#x2F;j-smile&#x2F;" rel="nofollow">https:&#x2F;&#x2F;terrainformatica.com&#x2F;org&#x2F;j-smile&#x2F;</a>) project.<p>That minimal JVM was of size 300 kb so nothing if to compare with the rest of .class files of your app. So Java executables can be in principle smaller than comparable Go&#x27;s executables.
评论 #26137754 未加载
torkus_1over 4 years ago
I use a Clojure, JavaFX, jlink and AppImage stack to build, bundle and distribute my app. I love it, it&#x27;s a lot of fun.<p>Here is my script to build a standalone linux binary: <a href="https:&#x2F;&#x2F;github.com&#x2F;ogri-la&#x2F;strongbox&#x2F;blob&#x2F;develop&#x2F;build-linux-image.sh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ogri-la&#x2F;strongbox&#x2F;blob&#x2F;develop&#x2F;build-linu...</a><p>It comes out to about ~55MB typically: <a href="https:&#x2F;&#x2F;github.com&#x2F;ogri-la&#x2F;strongbox&#x2F;releases" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ogri-la&#x2F;strongbox&#x2F;releases</a>
jorl17over 4 years ago
Many years ago, I wrote jar2app: <a href="https:&#x2F;&#x2F;github.com&#x2F;Jorl17&#x2F;jar2app" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Jorl17&#x2F;jar2app</a><p>At the time, I had a Minecraft jar on my hands, and I was tired of it not showing up in Spotlight&#x27;s results because it was &quot;just&quot; a Jar. So I cobbled together this lazy script to get around that. I guess I got carried away writing the documentation when I published it, but it was never meant to be used &quot;in production&quot;.<p>People often stumble upon the project and pose questions (same goes with some of my other projects like the barely-standing <a href="https:&#x2F;&#x2F;www.open-elevation.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.open-elevation.com&#x2F;</a> ), but I just don&#x27;t have the energy and time to fix things, answer issues and all tat jazz<p>I feel _really_ bad for not helping people out, clearing their doubts, fixing their issues, and improving my &quot;creations&quot; that were thrown out into the world. It&#x27;s just that from my perspective, these things I built are extremely simple, mostly weekend-projects, which were for my own use, and I just happened to put them out there to help out whoever needs them. I accept donations on <a href="https:&#x2F;&#x2F;www.open-elevation.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.open-elevation.com&#x2F;</a> to try to at least break-even on the cost of the hardware (I don&#x27;t, not even close, but that&#x27;s okay), but really I don&#x27;t have time and energy to help out...<p>All this to say that I&#x27;m sure if I had put in just a tiny bit of effort throughout the years, even if just by looking at issues and pull requests created by others, I&#x27;m sure jar2app could be on this list (and _especially_ because of the work that others could have put into it, if I just provided them with feedback once in a while).<p>So, if anyone&#x27;s out there, I&#x27;m sorry! I really just don&#x27;t have the time, energy and in some cases the money...
TeaVMFanover 4 years ago
The easiest way to distribute JVM applications on the desktop is the via the browser. TeaVM and Flavour make it easy to build rich browser apps in no time. You won&#x27;t even miss Swing or JavaFX!<p>Intro article: <a href="https:&#x2F;&#x2F;blogs.oracle.com&#x2F;javamagazine&#x2F;java-in-the-browser-with-teavm" rel="nofollow">https:&#x2F;&#x2F;blogs.oracle.com&#x2F;javamagazine&#x2F;java-in-the-browser-wi...</a><p>Migrating from Swing to TeaVM: <a href="https:&#x2F;&#x2F;frequal.com&#x2F;TeaVM&#x2F;migration&#x2F;MigratingFromSwingToTeaVm.html" rel="nofollow">https:&#x2F;&#x2F;frequal.com&#x2F;TeaVM&#x2F;migration&#x2F;MigratingFromSwingToTeaV...</a><p>A recent success story migrating from applets to TeaVM: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26135892" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26135892</a>
评论 #26136280 未加载
MaxBarracloughover 4 years ago
No mention of Graal. Does Graal Native Image work well with JavaFX? Seems appropriate to use ahead-of-time compilation for desktop applications.
评论 #26135894 未加载
评论 #26135900 未加载
ertucetinover 4 years ago
There is a new problem with jpackage after JDK 14, when your app depends on native libs, you&#x27;ll get UnsatisfiedLinkError. There is a ticket for that, but it seems that one core dev couldn&#x27;t repro it and the ticket is closed now... <a href="https:&#x2F;&#x2F;bugs.openjdk.java.net&#x2F;browse&#x2F;JDK-8259661" rel="nofollow">https:&#x2F;&#x2F;bugs.openjdk.java.net&#x2F;browse&#x2F;JDK-8259661</a>
评论 #26136434 未加载
msieover 4 years ago
For anyone wondering what a JRE has, which is more than a runtime: <a href="https:&#x2F;&#x2F;www.ibm.com&#x2F;cloud&#x2F;learn&#x2F;jre" rel="nofollow">https:&#x2F;&#x2F;www.ibm.com&#x2F;cloud&#x2F;learn&#x2F;jre</a>
EdwardDiegoover 4 years ago
I&#x27;m looking forward to seeing what jpackage can provide. <a href="https:&#x2F;&#x2F;docs.oracle.com&#x2F;en&#x2F;java&#x2F;javase&#x2F;15&#x2F;docs&#x2F;specs&#x2F;man&#x2F;jpackage.html" rel="nofollow">https:&#x2F;&#x2F;docs.oracle.com&#x2F;en&#x2F;java&#x2F;javase&#x2F;15&#x2F;docs&#x2F;specs&#x2F;man&#x2F;jpa...</a><p>Not sure about the platform specific builds, but I guess if you&#x27;re going for proper integration with a platform, it&#x27;s the easiest way.
amakeover 4 years ago
I can’t find a publishing date on TFA but<p>&gt; Launch4J is released under the BSD 3-Clause License but has not seen any release since 2017.<p>Launch4j had a release just the other day.
tealpodover 4 years ago
Other important and recent Java distrubution option is GraalVM Native Compilation. We are using it for a encryption app and Spring Boot app. Our final native version of GraalVM application is not only smaller in size but super fast. The only drawback with GraalVM is the time it takes to native compile is very high and heavy on CPU (I am sure this will be solved near future).
bullenover 4 years ago
I think the best way to do this is to just bundle a JRE in your application .zip?! You don&#x27;t need an app to do that!
评论 #26136012 未加载
mleonhardover 4 years ago
I&#x27;ve often wondered why Sun never made .JAR files an executable format like .sh, .bat, .tcl, .py, .doc, etc. It seems like a good way to reduce friction in binary distribution and get a lot more users of the language.<p>Can anyone share the reasons?
评论 #26151586 未加载
maxandersenover 4 years ago
try out jbang.dev - will download and install JDK for your .jar, .java or even .jsh as long as its available via http, git or maven repository.<p>(yes, I&#x27;m author of jbang.dev)
foobiekrover 4 years ago
The very few Java desktop applications I&#x27;ve been inflicted with have been terrible. Memory hogs, terrible UI, etc.<p>Maybe the time has simply passed?
评论 #26135890 未加载
评论 #26135911 未加载
评论 #26137101 未加载
unnouinceputover 4 years ago
Reading the article and seeing applets, my mind was like &quot;hey, 90&#x27;s tech, let&#x27;s talk about ActiveX too&quot;. I mean, if we&#x27;re talking about dead &amp; malware ridden tech for web ActiveX is king, followed by Java applets and only in the 3rd place is Flash.<p>Don&#x27;t get me wrong, current model of app stores and their &quot;verified&quot; apps is just as bad when it comes to malware, but hey, it is what it is.
评论 #26140616 未加载