我有一个 Java 小程序。我正在尝试使用 Java Web Start 打开它。我创建了以下 JNLP 文件:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://www.test.com/test"
href="http://www.test.com/test/TestJWS.jnlp">
<information>
<title>Test</title>
<vendor>Test</vendor>
</information>
<resources>
<!-- Application Resources -->
<j2se version="1.7+"
href="http://java.sun.com/products/autodl/j2se"/>
<jar href="test.jar"
main="true" />
</resources>
<security>
<all-permissions/>
</security>
<applet-desc
name="test"
main-class="main.testApplet"
width="300"
height="300">
<param name="TestParam" value="12345"/>
</applet-desc>
<update check="background"/>
</jnlp>
这是我的清单文件:
Permissions: all-permissions
Trusted-Library: true
Codebase: *
当我尝试在 Windows 8.1 或 Windows 7 中打开它时没有问题,一切都按预期工作。
但是当我尝试在 Windows 10 中打开它时,小程序无法获取 JNLP 文件中定义的参数。(我已经用 j8u45 和 j8u51 试过了)
我正在尝试使用此方法获取参数:
String java.applet.Applet.getParameter(String name)
示例:myTestApp.getParameter("TestParam")
这是异常的堆栈跟踪
java.lang.NullPointerException
at test.XApplicationVariables.getParameters(XApplicationVariables.java:527)
at test.MyApplet.init(TestApplet.java:71)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
我该如何解决这个问题?有解决方法吗?