If you are on #Java 11 and later, you really shouldn't be using a JRE.

Just build your own with jlink. Don't know how to use modules? Fine!

$ jlink --add-modules http://java.se  --output jre

$ ./jre/bin/java -version

$ JAVA_HOME=`pwd`/jre

Now learn how to trim it.
A really good starting point is this:

$ jlink
--add-modules http://java.se 
--strip-debug
--no-man-pages
--no-header-files
--compress=2
--output jre

Once you get used to this, learn about Java SE Modules, and how to select them, you can advance to using jdeps.
Have you dug into it yet? No? It's ok. Let's move forward. AdoptOpenJDK produces a JRE with modules that you may simply not need.

On the left side, you have the JDK, and on the right side, the JRE.

The third terminal is a jlinked JRE with ' http://java.se ' module.
Now, the jlinked JRE above may not be able to run everything a regular Java SE application may need because it is missing all of the 'jdk.*' modules.

jdk.charsets jdk.localedata jdk.xml.dom jdk.zipfs are a few I think may be needed too. But the only way to find out is w/ jdeps.
What you really should know is that: it is easy to come up with your own Java runtime with only the pieces your application needs, and this should be part of your build pipeline.

By the way, a jlinked runtime can be used to run traditional, classpath-based apps (no modules).
You can follow @brunoborges.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: