Java11以上版本只有jdk安装包,不再提供jre安装包,需要通过命令在jdk中提取生成jre,步骤如下:
(1)通过终端或命令行,切换到jdk的bin目录下:执行java --list-modules,列出所有模块列表
(2)执行jlink命令提取jre:
jlink --no-header-files --no-man-pages --compress=2 --add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,java.security.jgss,java.security.sasl,java.smartcardio,java.sql,java.sql.rowset,java.transaction.xa,java.xml,java.xml.crypto,jdk.accessibility,jdk.attach,jdk.charsets,jdk.compiler,jdk.crypto.cryptoki,jdk.crypto.ec,jdk.dynalink,jdk.editpad,jdk.hotspot