Open torakiki opened 1 year ago
Hello,
Different OpenJDK distributives provide different set of VMs, so you should use --vm option to get the expected result. Liberica JDK offers three VMs (Server, Client, Minimal) on some platforms, as well as additional components - OpenJFX, etc.
Also there are other components included in the Full version of Liberica JDK (read this as 'full of features - there are Client and Minimal VM + OpenJFX' and other necessary dependencies). If you use another OpenJDK distributive, and do not need to pass --vm, that only means that on this platform the other distributive does not offer Client and Minimal VM.
jlink allows you to create custom image with any VM and set of jmods. You can control content of your image to add any VM from Liberica Full bundle. By default jlink adds all VMs that are in the base image (seejlink --list-plugins
:
--vm <client|server|minimal|all>
Select the HotSpot VM in the output image.
Default is all
)
You can use it your own way and add any VM to resulting image. If you would like to get only Client or Server, add --vm client
or --vm server
options. Original question on SO mentioned that you use jpackage to create application, maybe the problem is with the application itself or with jpackage, we can investigate deeper if you provide a minimal example how to reproduce the issue - especially the options passed to jpackage and jlink you're using to create the image.
Also you can use the following options to control result image:
--jlink-options <jlink options>
A space separated list of options to pass to jlink
If not specified, defaults to "--strip-native-commands
--strip-debug --no-man-pages --no-header-files".
This option can be used multiple times.
--java-options <java options>
Options to pass to the Java runtime
This option can be used multiple times.
Thanks!
Following up this SO question, it seems that jlink from Liberica behaves differently from the one in Oracle JDK or in Temurin. Using version 19 and running the command
jlink --add-modules java.base --output ./out
generates a vm that containsclient
,server
andminimal
in itslib
subdirectory. Running the same command in Oracle JDK or Temurin it only generatesserver
. You can get the same result with Liberica by using the argument--vm=server
but, as pointed out in the SO replies, thevm
argument shouldn't be used. To add some context, I was using Temurin and switched to Liberica for my JavaFX app. I realized the jlinked image was bigger because it contained those lib subdirectory and I ended up using--vm=client
. Used jpackage pointing to the generated jvm to package my application and the .exe generated by jpackage fails to run.