我的应用程序是在oracle jdk8上开发的,UI是用javafx编写的。 UI 使用 javaws 运行,但是 openWebstart 无法启动相同的 UI,并出现错误“应用程序错误:不是可启动的 JNLP 文件”。 以下是日志片段:
[ITW-CORE][2023-10-25 16:00:51.610 IST][INFO ][net.sourceforge.jnlp.Parser] good - your JRE - 1.8.0_372 - match requested JRE - 1.8+
[ITW-CORE][2023-10-25 16:00:51.630 IST][ERROR][net.sourceforge.jnlp.AbstractLaunchHandler]
netx: Application Error: Not a launchable JNLP file.
net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Not a launchable JNLP file. File must be a JNLP application, applet, or installer type.
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:670)
[ITW-CORE][2023-10-25 16:00:51.631 IST][ERROR][net.sourceforge.jnlp.Launcher]
Launch exception
net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Not a launchable JNLP file. File must be a JNLP application, applet, or installer type.
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:670)
[ITW-CORE][2023-10-25 16:00:59.350 IST][INFO ][net.sourceforge.jnlp.util.logging.OutputController] Increase polling interval for shutdown phase
[ITW-CORE][2023-10-25 16:00:59.357 IST][INFO ][net.adoptopenjdk.icedteaweb.resources.cache.CacheImpl] No other instances of javaws are running
从他们的官方网站下载 OWS。使其成为打开 jnlp 文件的默认应用程序。在 OWS 设置中的 JVM Manager 中添加了 Java 1.8
Jnlp 文件:
<?xml version="1.0" encoding="ISO-8859-1"?>
<jnlp spec="1.0+" codebase="http://172.17.147.60:18080/pwui" href="pwui.jnlp">
<information>
<title>Management Client</title>
<icon kind="shortcut" href="image.jpg"/>
<shortcut online="true">
<desktop/>
</shortcut>
</information>
<resources>
<j2se version="1.8+" java-vm-args="-XX:MaxPermSize=256m" />
<jar href="Client.jar" main="true" />
<jar href="Common.jar" main="false" />
<jar href="EJBClient.jar" main="false" />
<jar href="jnlp.jar" main="false" />
<jar href="jbossall-client.jar" main="false" />
<jar href="FXExperienceControls.jar" main="false" />
<jar href="commons-codec-1.7.jar" main="false" />
<jar href="commons-io.jar" main="false" />
<jar href="itextpdf-5.4.1.jar" main="false" />
</resources>
<security><all-permissions/></security>
<jfx:javafx-desc main-class="com.client.fx.login.LoginScreen" />
<update check="always" policy="always" />
</jnlp>
据我所知,在 OpenWebStart 下使用的 IcedTea-Web 不支持
jfx:javafx-desc
。
相反,您需要一个
application-desc
来定义主类。
另请参阅此 OpenWebStart 常见问题解答条目:https://openwebstart.com/docs/FAQ.html#_how_to_run_openjfx_based_javafx_applications_with_openwebstar