使用Jlink在一个平台上为另一个平台创建Java运行时映像 [英] Create Java runtime image on one platform for another using Jlink

查看:429
本文介绍了使用Jlink在一个平台上为另一个平台创建Java运行时映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux机器上使用jlink创建了运行时映像。我在 include 文件夹下看到 linux 文件夹。这是否意味着我只能将此运行时映像用于Linux平台?如果是,有没有办法在一个平台上为另一个平台创建运行时映像(例如在Linux for Windows上,反之亦然)

I created runtime image using jlink on my Linux machine. And I see linux folder under the include folder. Does it mean that I can use this runtime image only for Linux platform? If yes, are there any ways to create runtime images on one platform for another (e.g. on Linux for Windows and vice versa)

推荐答案

include 目录用于编译C / C ++代码时所需的头文件,例如 jni.h 它使用JNI和其他本机接口。它与 jlink 无关。

The include directory is for header files, such as jni.h, that are needed when compiling C/C++ code that uses JNI and other native interfaces. It's nothing to do with jlink.

jlink 工具可以为另一个平台创建运行时映像(交叉定位)。您需要下载两个JDK才能执行此操作。一个用于运行 jlink 的平台,另一个用于目标平台。使用运行 jlink - 模块路径$ TARGET / jmods 其中 $ TARGET 是您为目标平台解压缩JDK的目录。

The jlink tool can create a run-time image for another platform (cross targeting). You need to download two JDKs to do this. One for the platform where you run jlink, the other for the target platform. Run jlink with --module-path $TARGET/jmods where $TARGET is the directory where you've unzipped the JDK for the target platform.

这篇关于使用Jlink在一个平台上为另一个平台创建Java运行时映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆