问题描述
我正在尝试为我的JAVA-9应用程序/项目拼图创建跨平台/平台无关的可执行文件.
I am trying to create cross platform / platform independent executables for my JAVA-9 application / project jigsaw.
我认为jlink命令只会创建特定于平台的可执行文件/运行时.
I think jlink command will create only platform specific executable/runtime.
推荐答案
JLink (由 JEP 282 覆盖)创建模块化运行时映像(由 JEP 220 ,特别是新运行时图像结构部分).这些映像是JRE,JDK和紧凑配置文件的概括,并且像OS一样是特定于操作系统的.因此,不能使用JLink创建跨平台的可执行文件.
JLink (covered by JEP 282) creates modular runtime images (covered by JEP 220, particularly the section New run-time image structure). These images are a generalization of JRE, JDK, and compact profiles and are OS specific like they are. JLink can hence not be used to create cross-platform executables.
也就是说,可以在一个操作系统上运行JLink并为一个不同的操作系统创建一个运行时映像.为此,您要做的就是下载并解压缩JDK 9(与JLink的版本相同),并将其jmods
文件夹放在JLink调用的模块路径上.
That said, it is possible to run JLink on one operating system and create a runtime image for a different OS. All you have to do for that is to download and unpack a JDK 9 (same version as the one JLink comes from) for that and put its jmods
folder on the module path for the JLink call.
这篇关于如何使用JLink命令为JDK9应用程序创建跨平台可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!