You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Open WebStart Java 8无法运行JNLP文件的问题求助

问题:Open WebStart启动JavaFX应用失败,报错“Not a launchable JNLP file”

我的应用基于Oracle JDK8开发,UI采用JavaFX实现,通过javaws可正常运行,但使用Open WebStart(OWS)启动时失败,报错:Application Error: Not a launchable JNLP file。

日志片段

[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管理器中添加了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>

解决方案

报错核心原因是Open WebStart对JavaFX的JNLP扩展支持要求更严格,需调整JNLP配置:

1. 补充JavaFX命名空间声明

Oracle javaws可自动识别未声明的jfx命名空间,但Open WebStart要求必须显式声明。修改<jnlp>标签:

<jnlp spec="1.0+" codebase="http://172.17.147.60:18080/pwui" href="pwui.jnlp" xmlns:jfx="http://javafx.com/javafx/8">

2. 替换JavaFX专属启动标签(兼容备选方案)

若添加命名空间后仍有问题,可改用标准JNLP应用启动标签替代jfx:javafx-desc:

<application-desc main-class="com.client.fx.login.LoginScreen" />

同时确认Client.jar的main="true"配置正确,且主类com.client.fx.login.LoginScreen存在并包含main方法。

3. 检查JavaFX运行时依赖

确保OWS使用的JDK8包含JavaFX运行时:

  • Oracle JDK8默认自带JavaFX,无需额外配置
  • 若使用OpenJDK8,需在OWS的JVM管理器中指定包含JavaFX的JDK路径,或在JNLP的<resources>中添加JavaFX相关jar包依赖

4. 验证JNLP文件合法性

用XML验证工具检查文件是否存在语法错误(如引号不匹配、标签未闭合、编码不一致等),确保文件格式符合JNLP规范。

内容的提问来源于stack exchange,提问作者Shipra Shahi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 22:10:09