简体   繁体   English

JDK9 Packager:在没有运行时的情况下创建映像

[英]JDK9 Packager: Create image without runtime

When using the Java Packager in Java 8, one had the choice to not include a runtime in the resulting image (see for example this question ). 在Java 8中使用Java Packager时,可以选择在结果映像中包括运行时(例如,参见此问题 )。

I'm trying to achieve the same (using the ant tasks described over here ). 我正在尝试实现相同的目标(使用此处所述的ant任务)。 However I don't know how to not include the JVM in the resulting .app or .exe file. 但是我不知道如何在生成的.app.exe文件中不包括JVM。

<fx:deploy nativeBundles="image" ...>
    <fx:runtime anythingICanDoHere?>
    ...
</fx:deploy>

The reason why I am asking: I am creating my own runtime using the jlink utility and want to replace the default runtime bundled with the application. 我问的原因:我正在使用jlink实用程序创建自己的运行时,并希望替换与应用程序捆绑在一起的默认运行时。 This works just fine, but as replace the default runtime anyway, it is an unnecessary step to include it in the first place. 这很好用,但是无论如何要替换默认的运行时,首先将它包括在内是不必要的步骤。

Side note: The application is not yet JPMS compliant, so the entire JVM is included. 旁注:该应用程序尚未兼容JPMS,因此包括了整个JVM。

The javapackager provided with JDK 9 and up uses jlink to generate the jre image: 所述javapackager设有JDK 9和最多使用jlink以生成所述图像的JRE:

For self-contained applications, the Java Packager for JDK 9 packages applications with a JDK 9 runtime image generated by the jlink tool. 对于独立的应用程序,用于JDK 9的Java Packager将应用程序与jlink工具生成的JDK 9运行时映像一起打包。 To package a JDK 8 or JDK 7 JRE with your application, use the JDK 8 Java Packager. 要将JDK 8或JDK 7 JRE与您的应用程序打包在一起,请使用JDK 8 Java Packager。

https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719 https://docs.oracle.com/javase/9​​/tools/javapackager.htm#JSWOR719

You can even pass arguments to jlink using -BjlinkOptions=<options> 甚至可以将参数传递给jlink使用-BjlinkOptions=<options>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM