如何在使用 OpenWebStart 的 WebStart 应用程序中使用 Openjfx。

huangapple go评论100阅读模式
英文:

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 &#39;path/javafx-sdk-11.0.2/lib&#39; --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:

    &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
    &lt;jnlp
      spec=&quot;1.0+&quot;
      codebase=&quot;http://localhost:8080/download/&quot;
      href=&quot;myapp.jnlp&quot;&gt;
      &lt;information&gt;
        &lt;title&gt;MyApp&lt;/title&gt;
        &lt;vendor&gt;Myself&lt;/vendor&gt;
        &lt;homepage href=&quot;http://localhost:8080&quot;/&gt;
        &lt;description&gt;My App&lt;/description&gt;
        &lt;description&gt;Migration test&lt;/description&gt;
        &lt;offline-allowed/&gt;
      &lt;/information&gt;

      &lt;security&gt;
         &lt;all-permissions/&gt;
      &lt;/security&gt;    

      &lt;resources&gt;
        &lt;j2se version=&quot;11&quot; 
          initial-heap-size=&quot;256m&quot; 
          max-heap-size=&quot;2048m&quot; 
          java-vm-args=&quot;-Xms256m -Xmx4096m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=25 --module-path &#39;/Users/chocksmith/Desktop/javafx-sdk-11.0.2/lib&#39; --add-modules javafx.controls,javafx.fxml&quot;/&gt;
        &lt;jar href=&quot;myapp-5.0.0.jar&quot;/&gt;
      &lt;/resources&gt;
      &lt;application-desc main-class=&quot;com.mycompany.myproduct.application.App&quot;/&gt; 
    &lt;/jnlp&gt; 

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&amp;package=jdk-fx

Use "OpenWebStart Settings.app" application to configure the right JVM on your system.

huangapple
  • 本文由 发表于 2020年4月3日 21:18:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/61012823.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定