使用 JNLP 文件启动应用程序

发布于 2024-12-19 20:56:28 字数 1465 浏览 2 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左岸枫 2024-12-26 20:56:28

由于此代码似乎依赖于 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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文