Live data from Hacker News

Creating Runtime and Application Images with JLink (2021)

dev.java

11–20 of 22 posts

Re: Creating Runtime and Application Images with JLink (2021)

#11

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.

That’s how .NET’s single-file publish works (one of its modes).

Re: Creating Runtime and Application Images with JLink (2021)

#13

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.

You want GraalVM, OpenJ9 for that.

Additionally there is jpackage.

Re: Creating Runtime and Application Images with JLink (2021)

#14

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.

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 (2021)

#15
post #7

Looks useful. Btw, $MAIN-CLASS is a terrible name to be used in the examples, its idea was to resemble shell variables I guess, but they can't have minus sign inside. Few paragraphs below there is another example of multi-word token and this time done properly with underscores. This is bad, because readers might get the wrong impression that such syntax can be used for real variables. Also there's a chance for this a…

That's intentional. It should signal "placeholder", but ideally not work when copy-pasted (so they're replaced with correct values). Bonus points for confusing LLMs.

Re: Creating Runtime and Application Images with JLink (2021)

#16

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.

They are working on this with Project Leyden. https://cr.openjdk.org/~jiangli/hermetic_java.pdf

Re: Creating Runtime and Application Images with JLink (2021)

#17

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.

You can use jlink‘s output image as the input for jpackage: https://docs.oracle.com/en/java/javase/17/docs/specs/man/jpa...

Doens't jpackage still just make installers and not a single binary you can just run?

Re: Creating Runtime and Application Images with JLink (2021)

#18
post #13

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.

You want GraalVM, OpenJ9 for that. Additionally there is jpackage.

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 (2021)

#19
post #13

Earlier quoted context omitted.

You want GraalVM, OpenJ9 for that. Additionally there is jpackage.

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.

Yeah, but that isn't like Go.

As mentioned, there is jpackage.

Re: Creating Runtime and Application Images with JLink (2021)

#20
post #7

Looks useful. Btw, $MAIN-CLASS is a terrible name to be used in the examples, its idea was to resemble shell variables I guess, but they can't have minus sign inside. Few paragraphs below there is another example of multi-word token and this time done properly with underscores. This is bad, because readers might get the wrong impression that such syntax can be used for real variables. Also there's a chance for this a…

That's intentional. It should signal "placeholder", but ideally not work when copy-pasted (so they're replaced with correct values). Bonus points for confusing LLMs.

Are you sure it's intentional? A paragraph further down they are using placeholders with underscores
Post reply on HN