How-to Build Custom Java Runtimes with Jlink
Ғылым және технология
Jlink is a powerful tool in the JDK for creating custom runtimes based on the modules an application needs to run. In this video, we will introduce the key concepts and benefits of using jlink and go through five steps covering the key features used when creating a custom runtime.
The code used in this video can be found in this Github Repo ➱ github.com/java/samples/tree/...
Chapters
0:00 intro
1:11 Basics of jlink
2:35 Using JDeps
3:43 Adding Non-JDK Modules to an Image
5:25 Adding Explicit Modules to an Image
7:26 Additional Image Customization Options
8:44 Conclusion
Resources
- The jlink Command ➱ docs.oracle.com/en/java/javas...
- jlink tutorial ➱ dev.java/learn/jvm/tools/core...
- Overview of "almost all" Java modules published at Maven Central ➱ github.com/sormuras/modules
- Dev.java ➱ dev.java
- Inside.java ➱ inside.java
Tags #Java #Cloud #OpenJDK #JDK #JVM #InsideJava
Пікірлер: 18
Please make a video with the build tools: Maven & for Spring Boot Framework
@billykorando6820
9 күн бұрын
Ha, kinda figured that would be the response. But good to know there's a demand before committing to the video. 😄
for sure a follow up video with some popular Framework + Gradle/Maven + Docker would be great.
Great video. Simple and effective!
A Spring boot + maven build process using jlink would be much appreciated, thanx
Nice video! Thank you; and I am all in for some more good stuff (mvn, other tools, etc.)
Do one on jpackage, please, and how to use jlink together.
@1973Gerhard
9 күн бұрын
+1
@billykorando6820
9 күн бұрын
Yea, that is also a natural next step. Will look into that as well.
Cool!
Would like to see how we could leverage jdeps and jlink for complex applications like keycloak (with Quarkus runtime).
Please make a video with the build tools: Maven & for Spring Boot Framework waiting for it
Is there a specific reason to create a jmod file from the foo module before linking it in the jlink image (rather than creating a modularized jar)?
One with Maven and also maybe an application server like Glassfish, Payara, etc... Is it possible? I know OSGi might be troublesome.
@billykorando6820
7 күн бұрын
I don’t know if covering a bunch of different frameworks makes a lot of sense unless there’s a specific use case. Right now my thinking on the second video would be to cover Spring Boot, where only some of the underlying dependencies are modularized and Helidon, which to my knowledge, all dependencies are modularized. I think from there the benefits and practices should be reasonably replicable across most projects. If there’s the demand, numbers, and concrete examples, might do a third video on specific edge use cases.
HI i am getting error while running a simple hello world program Caused by: java.lang.ClassNotFoundException: first.HelloWorld
@philippedeneve3130
3 сағат бұрын
The classpath argument (-cp) seems to be missing in the example. For your convenience, try executing the following commands: mkdir jlink_example cd jlink_example mkdir -p src/foo mkdir out echo 'package foo; public class HelloWorld{ public static void main(String[] args){ System.out.println("Hello JLink!"); } }' >src/foo/HelloWorld.java javac -d out src/foo/HelloWorld.java jlink --add-modules java.base --output hello-jlink-image ./hello-jlink-image/bin/java -cp out foo.HelloWorld