如何在 JNLP 文件中指定小程序库

发布于 2024-10-07 06:26:19 字数 1978 浏览 0 评论 0原文

我正在尝试使用 JNLP 部署小程序。文件结构如下:

/
  dbstats.html
  dbstats.jnlp
  dbstats.jar
  lib/
    substance.jar
    trident.jar
    guava-0.7.jar

这是我的 HTML:

<html>
    <head>
        <title>Dreambearstatistieken</title>

        <script src="http://www.java.com/js/deployJava.js"></script>
        <script type="text/javascript">

            var attributes = {
                code:'dreambear.stats.viewer.DBStatsViewer',
                width:900, height:600
            };
            var parameters = {jnlp_href: "dbstats.jnlp"};
            var version = "1.6";

        </script>

    </head>
    <body>

    <script type="text/javascript">
        deployJava.runApplet(attributes, parameters, version);
    </script>

    </body>
</html>

和 JNLP 文件:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
    <information>
        <title>Dreambearstatistieken</title>
        <vendor>Weber</vendor>
    </information>
    <resources>
        <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
        <jar href="lib/trident.jar" />  
        <jar href="lib/substance.jar" />
        <jar href="lib/guava-r07.jar" />
        <jar href="dbstats.jar" main="true" />
    </resources>
    <applet-desc 
         name="Dreambearstatistieken"
         main-class="dreambear.stats.viewer.DBStatsViewer"
         width="900"
         height="600">
     </applet-desc>
     <update check="background" />
</jnlp> 

据我所知,一切都应该没问题,但事实并非如此。我在 org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel 上收到 ClassNotFoundException,该异常位于 substance.jar 中。我做错了什么?

更广泛地说,有关于 2010 年代使用小程序和 JNLP 的好的教程或书籍吗?

I'm trying to deploy an applet using JNLP. The file structure is thus:

/
  dbstats.html
  dbstats.jnlp
  dbstats.jar
  lib/
    substance.jar
    trident.jar
    guava-0.7.jar

Here's my HTML:

<html>
    <head>
        <title>Dreambearstatistieken</title>

        <script src="http://www.java.com/js/deployJava.js"></script>
        <script type="text/javascript">

            var attributes = {
                code:'dreambear.stats.viewer.DBStatsViewer',
                width:900, height:600
            };
            var parameters = {jnlp_href: "dbstats.jnlp"};
            var version = "1.6";

        </script>

    </head>
    <body>

    <script type="text/javascript">
        deployJava.runApplet(attributes, parameters, version);
    </script>

    </body>
</html>

And the JNLP file:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
    <information>
        <title>Dreambearstatistieken</title>
        <vendor>Weber</vendor>
    </information>
    <resources>
        <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
        <jar href="lib/trident.jar" />  
        <jar href="lib/substance.jar" />
        <jar href="lib/guava-r07.jar" />
        <jar href="dbstats.jar" main="true" />
    </resources>
    <applet-desc 
         name="Dreambearstatistieken"
         main-class="dreambear.stats.viewer.DBStatsViewer"
         width="900"
         height="600">
     </applet-desc>
     <update check="background" />
</jnlp> 

As far as I can see, everything should be ok, but it's not. I get a ClassNotFoundException on org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel, which is in substance.jar. What am I doing wrong?

And wider, is there a good tutorial or book about using applets and JNLP in the 2010s?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

内心荒芜 2024-10-14 06:26:19

首先,您的代码库是空的。据我记得它应该包含您的应用程序的绝对路径。也许我错了,但从这里开始。如果它有帮助,但您希望重用 jnlp 文件,请尝试 codebase="." (虽然我不确定它是否合法。)

接下来,尝试使用浏览器下载 lib 目录下的 jar 之一。需要确保该目录可访问。

祝你好运!

First your codebase is empty. As far as I remember it should contain the absolute path to your application. Probably I am wrong but start from this. If it helps but you wish to reuse the jnlp file try codebase="." (although I am not sure it is legal.)

Next, try to download one of the jars under lib directory using browser. It is needed to be sure that this directory is accessible.

Good luck!

锦爱 2024-10-14 06:26:19

您还必须将 jlnp 的名称放在 href="" 上。这样做:

<jnlp spec="1.0+" codebase="http://mydomain:5500/myapp" href="dbstats.jnlp">

You have to put the jlnp's name on href="" as well. Do it like this:

<jnlp spec="1.0+" codebase="http://mydomain:5500/myapp" href="dbstats.jnlp">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文