使用JNLP文件启动应用程序 [英] Using JNLP File to launch an application

查看:75
本文介绍了使用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文件:

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>

所有的jar都在各自的目录中,但是当我双击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

及其完整的错误堆栈.

就像我只是通过双击运行我的swing应用程序(TryJNLP.jar)一样,它运行完美.

where as if I simply runs my swing application(TryJNLP.jar) by double clicking, it runs perfectly.

请帮助我.

推荐答案

由于此代码似乎依赖于JSR 296,因此有必要在应用程序的运行时类路径中添加ApplicationFramework-<version>.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).

这篇关于使用JNLP文件启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆