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.

Compiling Java into native binaries with Graal and Mill

154 pointsby lihaoyi3 months ago

6 comments

wiradikusuma3 months ago
&quot;Almost every Java program, library, and framework uses some degree of reflection and dynamic classloading, and so you do have to spend the effort to configure Graal appropriately.&quot; -- this is by far the biggest problem with native binary compilation.<p>Imagine spending 15+ minutes building an exe, and it stopping at minute 15 because some things needed to be added in the config. Or, after waiting 30 minutes to have the exe ready, it refused to run because of the same problem.<p>The issue is we don&#x27;t know what we don&#x27;t know. You don&#x27;t &quot;forget to include something&quot; because you don&#x27;t know what to include (and even after seeing the error, you still don&#x27;t lol).<p>I just wished all 3rd party libraries put their &quot;include this config to include my lib in your exe&quot;, just like OSGi manifest (<a href="https:&#x2F;&#x2F;www.ibm.com&#x2F;docs&#x2F;en&#x2F;wasdtfe?topic=overview-osgi-bundles" rel="nofollow">https:&#x2F;&#x2F;www.ibm.com&#x2F;docs&#x2F;en&#x2F;wasdtfe?topic=overview-osgi-bund...</a>).<p>For example, an issue still open for almost 2 years: <a href="https:&#x2F;&#x2F;github.com&#x2F;firebase&#x2F;firebase-admin-java&#x2F;issues&#x2F;800">https:&#x2F;&#x2F;github.com&#x2F;firebase&#x2F;firebase-admin-java&#x2F;issues&#x2F;800</a>
评论 #42929382 未加载
评论 #42906385 未加载
评论 #42929770 未加载
评论 #42930917 未加载
评论 #42930850 未加载
评论 #42931561 未加载
评论 #42910656 未加载
p2detar3 months ago
&gt; Graal can only create native binaries targeting the system on which it is running. That means that if you want to create binaries for {Linux,Windows,Mac}x{Intel,ARM}, you need 6 different machines in order to build the 6 binaries and somehow aggregate them together for publication or deployment. This is not a blocker, but can definitely be inconvenient v.s. some other toolchains which allow you to build native binaries for all targets on a single machine.<p>To me this is a huge downside. One of the reasons I like Go so much is that I can build binaries for any platform I want to support on my Mac or with Docker.
评论 #42928863 未加载
评论 #42928464 未加载
评论 #42928936 未加载
评论 #42930862 未加载
评论 #42928741 未加载
评论 #42928517 未加载
评论 #42930854 未加载
评论 #42928759 未加载
评论 #42930928 未加载
评论 #42928732 未加载
评论 #42929620 未加载
dkjaudyeqooe3 months ago
I&#x27;m under the impression that the Community Edition version of GraalVM is neutered by a limited garbage collector and some other limitations when producing native binaries.<p>Anyone know if this true?
评论 #42930876 未加载
评论 #42930731 未加载
评论 #42930157 未加载
theflyinghorse3 months ago
Mill looks like an interesting option to try all around.
neonsunset3 months ago
<p><pre><code> dotnet publish &#x2F;p:PublishAot=true </code></pre> :)
评论 #42930921 未加载
评论 #42930555 未加载
neuroelectron3 months ago
Java had a huge reflection exploit a long time ago and most places blacklisted that library as a result so not a big loss there.
评论 #42931684 未加载