英文:
How to use Openjfx in a webstart application using OpenWebStart
问题
我们正在将一个使用Java 1.8的JavaFX/Webstart应用迁移到Java 11,使用Openjfx(https://openjfx.io)和OpenWebStart(https://openwebstart.com)。
我们已经成功将应用迁移到JavaFx-14(OpenJfx)并运行起来。现在在IDE中运行它需要包括以下JVM参数:
--module-path 'path/javafx-sdk-11.0.2/lib' --add-modules javafx.controls,javafx.fxml
我们使用Maven构建该应用。它在Java 1.8上运行得很好。它签署了所有的jar文件,创建了包和jnlp文件。Maven还创建了一个包含所有依赖项的"uber jar"。我们迁移了POM文件,包括了新的依赖。我们通过手动使用命令行运行"uber jar"文件来测试它(使用--module-path参数)。
我们在.jnlp文件中包含了--module-path参数:
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
codebase="http://localhost:8080/download/"
href="myapp.jnlp">
<information>
<title>MyApp</title>
<vendor>Myself</vendor>
<homepage href="http://localhost:8080"/>
<description>My App</description>
<description>Migration test</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="11"
initial-heap-size="256m"
max-heap-size="2048m"
java-vm-args="-Xms256m -Xmx4096m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=25 --module-path '/Users/chocksmith/Desktop/javafx-sdk-11.0.2/lib' --add-modules javafx.controls,javafx.fxml"/>
<jar href="myapp-5.0.0.jar"/>
</resources>
<application-desc main-class="com.mycompany.myproduct.application.App"/>
</jnlp>
不幸的是,它失败了:
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:670)
我们已经没有更多的想法了。请给予建议!
英文:
We are migrating a Java 1.8 JavaFX/Webstart application to Java 11 using Openjfx (https://openjfx.io) and OpenWebStart (https://openwebstart.com).
We successfully migrate and run the app to JavaFx-14 (OpenJfx). To run it at the IDE now it is necessary to include the following jvm args:
--module-path 'path/javafx-sdk-11.0.2/lib' --add-modules javafx.controls,javafx.fxml
We build the App using Maven. It beautifully works on Java 1.8. It signs all jars, create the package and the jnlp file. Maven also creates an "uber jar" with all dependencies included. We migrated the POM including the new deps. We tested it by manually running the App using the uber jar file via command line (using the --module-path parameters).
We included the --module-path argument in .jnlp file:
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
codebase="http://localhost:8080/download/"
href="myapp.jnlp">
<information>
<title>MyApp</title>
<vendor>Myself</vendor>
<homepage href="http://localhost:8080"/>
<description>My App</description>
<description>Migration test</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="11"
initial-heap-size="256m"
max-heap-size="2048m"
java-vm-args="-Xms256m -Xmx4096m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=25 --module-path '/Users/chocksmith/Desktop/javafx-sdk-11.0.2/lib' --add-modules javafx.controls,javafx.fxml"/>
<jar href="myapp-5.0.0.jar"/>
</resources>
<application-desc main-class="com.mycompany.myproduct.application.App"/>
</jnlp>
Unfortunately it fails:
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:670)
We run out of ideas here. Please advise!
答案1
得分: 2
OpenWebStart现在在常见问题解答中提供了关于在JavaFX基础应用程序中运行的一些信息:https://github.com/karakun/OpenWebStart/blob/master/documentation/faq/FAQ.adoc
如果这些信息无法帮助您,请在https://github.com/karakun/OpenWebStart/issues上提出问题。
英文:
OpenWebStart now provides several points about running JavaFX based application in an FAQ: https://github.com/karakun/OpenWebStart/blob/master/documentation/faq/FAQ.adoc
If this does not help please open an issue at https://github.com/karakun/OpenWebStart/issues
答案2
得分: 1
FX必须在客户端的JDK中捆绑。
我们成功地使其与Zulu社区版13.29.11配合使用。
使用以下链接下载:https://www.azul.com/downloads/zulu-community/?architecture=x86-64-bit&package=jdk-fx
使用"OpenWebStart Settings.app"应用程序在您的系统上配置正确的JVM。
英文:
FX must be bundled in the JDK on the client side.
We manage to make it work with Zulo Community version 13.29.11
https://www.azul.com/downloads/zulu-community/?architecture=x86-64-bit&package=jdk-fx
Use "OpenWebStart Settings.app" application to configure the right JVM on your system.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论