如何在 JNLP 文件中指定小程序库
我正在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您的代码库是空的。据我记得它应该包含您的应用程序的绝对路径。也许我错了,但从这里开始。如果它有帮助,但您希望重用 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!
您还必须将
jlnp
的名称放在href=""
上。这样做:You have to put the
jlnp
's name onhref=""
as well. Do it like this: