News for hackers. Stuff that matters.
Re:Creating Runtime and Application Images with JLink by vbezhenar on Thursday November 07, 2024 @06:38AM (#42075782)
I wish they would make it produce single statically linked file. Golang is so awesome in that regard. Should not be hard: embed JRE and append jar stuff into the end, write special classloader for this format and that's about it.

Right now it produces directory similar to JRE itself, so makes little sense to me, nobody cares about directory size, but single file ergonomics is a real deal.

Re:Creating Runtime and Application Images with JLink by neonsunset on Thursday November 07, 2024 @06:52AM (#42075858)
That’s how .NET’s single-file publish works (one of its modes).
Re:Creating Runtime and Application Images with JLink by pjmlp on Thursday November 07, 2024 @09:47AM (#42077058)
You want GraalVM, OpenJ9 for that.

Additionally there is jpackage.

Re:Creating Runtime and Application Images with JLink by vbezhenar on Friday November 08, 2024 @02:34AM (#42085001)
GraalVM is very different league. It actually compiles Java application into native code, which takes enormous amount of RAM and processing time. Also it requires adapting application, because it's not a compliant JVM. What I mean is just packaging JVM and related jars into a single runnable artifact which is much simpler task.
Re:Creating Runtime and Application Images with JLink by pjmlp on Friday November 08, 2024 @06:56AM (#42086147)
Yeah, but that isn't like Go.

As mentioned, there is jpackage.

Re:Creating Runtime and Application Images with JLink by vbezhenar on Sunday November 10, 2024 @04:14AM (#42099223)
jpackage is just tool to create installer. I don't think it suits for this task. I don't want to create installer. I want to create an executable binary which I'd put into my /usr/local/bin.
Re:Creating Runtime and Application Images with JLink by alex_suzuki on Thursday November 07, 2024 @11:17AM (#42077975)
You can use jlink‘s output image as the input for jpackage: https://docs.oracle.com/en/java/javase/17/docs/specs/man/jpa...
Re:Creating Runtime and Application Images with JLink by vips7L on Thursday November 07, 2024 @11:34AM (#42078161)
Doens't jpackage still just make installers and not a single binary you can just run?
Re:Creating Runtime and Application Images with JLink by vips7L on Thursday November 07, 2024 @11:33AM (#42078148)
They are working on this with Project Leyden. https://cr.openjdk.org/~jiangli/hermetic_java.pdf