I created runtime image using jlink on my Linux machine. And I see linux
folder under the include
folder. Does it mean that I can use this runtime image only for Linux platform? If yes, are there any ways to create runtime images on one platform for another (e.g. on Linux for Windows and vice versa)
To create a custom Java runtime image for your application, run jlink before you package your application. Then pass the image produced to the packaging tool using the --runtime-image option.
Jlink is a Java command line tool that is used to generate a custom Java runtime environment (JRE). You can use your customized JRE to run Java applications. Using jlink, you can create a custom runtime environment that only includes the relevant class file.
jlink is a tool that generates a custom Java runtime image that contains only the platform modules that are required for a given application. Such a runtime image acts exactly like the JRE but contains only the modules we picked and the dependencies they need to function.
The include
directory is for header files, such as jni.h
, that are needed when compiling C/C++ code that uses JNI and other native interfaces. It's nothing to do with jlink
.
The jlink
tool can create a run-time image for another platform (cross targeting). You need to download two JDKs to do this. One for the platform where you run jlink
, the other for the target platform. Run jlink
with --module-path $TARGET/jmods
where $TARGET
is the directory where you've unzipped the JDK for the target platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With