Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build (and publish) a jpackage-d "native" (not really) executable #391

Open
vorburger opened this issue Dec 31, 2023 · 3 comments
Open

Build (and publish) a jpackage-d "native" (not really) executable #391

vorburger opened this issue Dec 31, 2023 · 3 comments
Labels
build Build, CI, etc. (w.o. #testing) distro Distribution related enhancement New feature or request help wanted Extra attention is needed

Comments

@vorburger
Copy link
Member

https://www.baeldung.com/java14-jpackage

https://www.baeldung.com/jar-windows-executables

https://www.baeldung.com/jlink

@vorburger vorburger added build Build, CI, etc. (w.o. #testing) distro Distribution related labels Dec 31, 2023
@vorburger vorburger added enhancement New feature or request help wanted Extra attention is needed labels Dec 31, 2023
@vorburger
Copy link
Member Author

I've dabbled with this a bit today, something like this actually works:

$ ~/.cache/bazel/_bazel_vorburger/a3c...bf4/external/remotejdk21_linux/bin/jlink \
        --no-header-files --no-man-pages --compress=zip-9 --strip-debug \
        --add-modules java.logging,java.xml --output site/download/latest/jre

$ site/download/latest/jre/bin/java -jar bazel-bin/java/dev/enola/cli/enola_deploy.jar -V

$  du -h site/download/latest/jre/
43M

Note that this smaller JRE does NOT (seem to) improve JRE boot start-up speed; it actually seems to be slightly slower, for some reason, for me:

$ time ~/.cache/bazel/_bazel_vorburger/a3c...bf4/external/remotejdk21_linux/bin/java -jar bazel-bin/java/dev/enola/cli/enola_deploy.jar -V
~240ms

$ time site/download/latest/jre/bin/java -jar bazel-bin/java/dev/enola/cli/enola_deploy.jar -V
~310ms

BTW jpackage apparently only builds (a DMG or PKG for Mac, MSI or EXE for Win, or) DEB and RPM - that's not the point of interest, here. (That should be done by distros.)

As far as I understand, there isn't really any way to "build (and publish) a jpackage-d (not really) 'native' executable".

What could be done with this is to re-distribute such a minimal JDK together with the (existing) single JAR.

This could be in different (and possibly several) formats, including:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build, CI, etc. (w.o. #testing) distro Distribution related enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant