构建Java模块运行时图像对其他操作系统
我重写我的小Java 8项目从简单的jar到单个模块在Java 11。 在过去我和Gradle构建jar兼容Windows和Linux。 现在我配置Gradle构建模块和创建自定义运行时图像,但只有在Linux上工作。 我的自定义运行时图像仅包含Linux库。 有可能在Linux上构建图像为Windows ? 我知道我可以打开我的项目在Windows和创建图像但我想保持我的项目单一的操作系统。 这是我Gradle构建:
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
}
group 'eu.sample'
version '2.0'
repositories {
mavenCentral()
}
javafx {
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
mainClassName = "$moduleName/eu.sample.app.Main"
def java_home = hasProperty('org.gradle.java.home') ? getProperty('org.gradle.java.home') : System.getenv('JAVA_HOME')
def fx_jmods = hasProperty('path.to.fx.mods') ? getProperty('path.to.fx.mods') : System.getenv('PATH_TO_FX_MODS')
dependencies {
}
task jlink(type: Exec) {
dependsOn 'clean'
dependsOn 'jar'
workingDir 'build' if (java_home == null) { throw new RuntimeException("java_home is not defined.") } if (fx_jmods == null) { throw new RuntimeException("fx_jmods is not defined.") } commandLine "${java_home}/bin/jlink", '--module-path', "libs${File.pathSeparatorChar}${fx_jmods}", '--add-modules', "${moduleName}", '--output', "${moduleName}", '--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'
}
我添加了。 gradle行,之前火jlinkWin任务我运行清洁任务:
task jlinkWin(type: Exec) {
dependsOn 'clean'
dependsOn 'jar'
workingDir 'build' if (java_home == null) { throw new RuntimeException("java_home is not defined.") } if (fx_jmods == null) { throw new RuntimeException("fx_jmods is not defined.") } commandLine "${java_home}/bin/jlink", '--module-path', "/home/user1/Download/win-jdk-11.0.1/jmods${File.pathSeparatorChar}libs${File.pathSeparatorChar}${fx_jmods}", '--add-modules', "${moduleName}", '--output', "${moduleName}", '--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'
}
好吧我发现解决方案。 更新的代码上面创建自定义运行时图像窗口。
- 构建自己的监测器【1】-监测工具 注:监控java代码运行情况
- java并发编程_基本模块构建
- 【Java并发.5】基础构建模块
- 运行jar应用程序引用其他jar包的四种方法(java命令)
- [Java Concurrency in Practice]第五章 基础构建模块
- 【java基础】运行jar应用程序引用其他jar包的四种方法
- Java并发编程学习——基础构建模块
- JAVA并发编程学习笔记------基础构建模块
- 建立在其他操作系统上的非抢占式操作系统正在构建中
- Java并发基础构建模块简介
- 后台运行 esearch 和 其他用户安装java 环境变量
- 源代码 .java文件 IDEA 构建 运行 javase项目
- 在java程序中执行dos命令或运行其他程序
- zepto.js 自定义打包集成其他模块构建流程
- Java并发读书学习笔记(四)——基础构建模块
- SpringBoot+Maven 多模块项目的构建、运行、打包实战
- java—(3)maven构建项目(多模块项目)
- 大型JavaWeb分布式系统中关于maven多模块构建以及代码依赖管理
- 不安装python运行python文件或者是用其他语言调用python模块的方法
- Maven学习(2) - Maven构建多模块Java工程