News for hackers. Stuff that matters.
Re:GraalVM by bmc7505 on Monday August 10, 2020 @12:03AM (#24105419)
> You can compile your Java code into an executable which doesn't require Java to be present.

Wasn't this feature already supported in JDK 14 with the jpackage tool?

https://openjdk.java.net/jeps/343

Re:GraalVM by vbsteven on Monday August 10, 2020 @12:55AM (#24105683)
If I understand correctly, the difference between jpackage and GraalVM is this:

Jpackage bundles a small Java VM (with only the features you use) together with your compiled bytecode into a single executable. When it runs it starts up the VM and executes bytecode on that VM exactly the same as it would be if you were to run a jar on a preexisting JDK/JRE installation.

Graal compiles your full app ahead of time into a native code binary. There is no bytecode/translation happening at runtime. That is why GraalVM advertises faster startup and lower memory footprint.

So there are essentially 3 ways to run JVM (Java/Scala/Kotlin/...) code:

* compile into bytecode jar -> requires existing VM runtime

* compile into bytecode jar + bundle VM runtime -> no dependencies required, runs as the previous option

* compile into native binary -> no dependencies required, runs native, starts and runs faster

Re:GraalVM by vips7L on Monday August 10, 2020 @08:53AM (#24108706)
> Jpackage bundles a small Java VM (with only the features you use) together with your compiled bytecode into a single executable. When it runs it starts up the VM and executes bytecode on that VM exactly the same as it would be if you were to run a jar on a preexisting JDK/JRE installation.

This is incorrect. Jpackage creates an installer which will unpack the VM image and any other resources.

I've tried it with a small CLI tool and it actually doesn't work that well (at least on Windows).

Re:GraalVM by bmc7505 on Monday August 10, 2020 @12:58AM (#24105701)
Makes sense, thanks for clarifying!
Re:GraalVM by brabel on Monday August 10, 2020 @02:48AM (#24106326)
It's actually jlink that is already available and creates a minimal JVM with your application code that you can distribute as OS-specific bundles... jpackage, which is still in beta (and doesn't work very well, I've tried it recently), will take the output of jlink and turn that into some common OS-specific packages, like RPM, Debian and dmg.
Re:GraalVM by vips7L on Monday August 10, 2020 @08:55AM (#24108721)
> and doesn't work very well, I've tried it recently)

This is my experience as well. After installation, my installed app just didn't do anything.

Re:GraalVM by nsonha on Monday August 10, 2020 @12:29AM (#24105575)
I believe because dead code elimination isn't currently possible with JVM, "package to binary" would mean including the whole (or most of) JVM with your program.