使用 JNLP 文件启动应用程序
我有一个 jsp 页面为:
<html>
<head>
<title>Try in JNLP</title>
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var dir = location.href.substring(0, location.href.lastIndexOf('/')+1);
var url = dir + "try.jnlp";
deployJava.createWebStartLaunchButton(url, '1.6.0');
</script>
<noscript>JavaScript is required for this page.</noscript>
</head>
<body>
</body>
</html>
并有一个 jnlp 文件为:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/try/" href="try.jnlp">
<information>
<title>TRY JNLP</title>
<vendor>TRY JNLP</vendor>
</information>
<resources>
<!-- Application Resources -->
<jar href="TryJNLP.jar" main="true" />
</resources>
<application-desc name="Try JNLP" main-class="tryjnlp.TRYJNLPApp">
</application-desc>
<update check="background"/>
</jnlp>
所有 jar 都在各自的目录中,但是当我双击 jnlp 文件时,它向我显示一个错误:
java.lang.NoClassDefFoundError: org/jdesktop/application/SingleFrameApplication
及其完整的错误堆栈。
就好像我只是通过双击来运行我的 swing 应用程序(TryJNLP.jar)一样,它运行得很好。
请帮我。
I have a jsp page as:
<html>
<head>
<title>Try in JNLP</title>
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var dir = location.href.substring(0, location.href.lastIndexOf('/')+1);
var url = dir + "try.jnlp";
deployJava.createWebStartLaunchButton(url, '1.6.0');
</script>
<noscript>JavaScript is required for this page.</noscript>
</head>
<body>
</body>
</html>
and have a jnlp file as :
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/try/" href="try.jnlp">
<information>
<title>TRY JNLP</title>
<vendor>TRY JNLP</vendor>
</information>
<resources>
<!-- Application Resources -->
<jar href="TryJNLP.jar" main="true" />
</resources>
<application-desc name="Try JNLP" main-class="tryjnlp.TRYJNLPApp">
</application-desc>
<update check="background"/>
</jnlp>
All jars are in their respective directories but when I double click the jnlp file it shows me an error saying :
java.lang.NoClassDefFoundError: org/jdesktop/application/SingleFrameApplication
with the its full error stack.
where as if I simply runs my swing application(TryJNLP.jar) by double clicking, it runs perfectly.
Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于此代码似乎依赖于 JSR 296,因此需要将
ApplicationFramework-.jar
添加到应用程序的运行时类路径(在JNLP)。Since this code seems to depend on JSR 296, it will be necessary to add the:
ApplicationFramework-<version>.jar
to the run-time class-path of the application (in the resources section of the JNLP).