java - 尝试使用 jnlp 部署 java applet

标签 java deployment applet jnlp next-generation-plugin

我正在尝试使用 jnlp 部署小程序

我的 jnlp 文件:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.6" codebase="http://localhost:8080/docRuleTool/appletjars/" href="dynamictree-applet.jnlp">
    <information>
        <title>dynamictree</title>
        <vendor>dynamic</vendor>
    </information>
    <resources>
        <j2se version="1.6" href="http://localhost:8080/docRuleTool/appletjars/" />
        <jar href="dynamictree.jar" main="true" />
        <jar href="prefuse.jar" main="true" />
    </resources>
    <applet-desc 
         name="dynamictree-applet"
         main-class="com.vaannila.utility.dynamicTreeApplet.class"
         width="1000"
         height="1000">
     </applet-desc>
     <update check="background"/>
</jnlp>

我的小程序代码:

<script src="http://www.java.com/js/deployJava.js"></script>
<script>
    var attributes = { id:'DynamicApplet', code:'jstojava.dynamicTreeApplet',} ;
    var parameters = {jnlp_href:'./appletjars/dynamictree-applet.jnlp'} ;
    deployJava.runApplet(attributes, parameters, '1.6');
</script>

我的 JavaScript :

function showSelected(value){
alert("the value given from  "+value);  
DynamicApplet.dieasenameencode=value; 
}

我收到错误:

execption: The application has requested a version of the JRE (version 1.6) that currently is not locally installed. Java Web Start is unable to automatically download and install the requested version. This JRE must be installed manually..
JNLPException[category: System Configuration : Exception: null : LaunchDesc: 
<jnlp spec="1.6" codebase="http://localhost:8080/docRuleTool/appletjars/" href="http://localhost:8080/docRuleTool/appletjars/dynamictree-applet.jnlp">
  <information>
    <title>dynamictree</title>
    <vendor>dynamic</vendor>
    <homepage href="null"/>
  </information>
  <update check="background" policy="always"/>
  <resources>
    <java href="http://localhost:8080/docRuleTool/appletjars/" version="1.6"/>
    <jar href="http://localhost:8080/docRuleTool/appletjars/dynamictree.jar" download="eager" main="true"/>
    <jar href="http://localhost:8080/docRuleTool/appletjars/prefuse.jar" download="eager" main="true"/>
  </resources>
  <applet-desc name="dynamictree-applet" main-class="com.vaannila.utility.dynamicTreeApplet.class" documentbase="http://localhost:8080/docRuleTool/" width="1000" height="1000"/>
</jnlp> ]
    at sun.plugin2.applet.JNLP2Manager.downloadJREResource(Unknown Source)
    at sun.plugin2.applet.JNLP2Manager.prepareLaunchFile(Unknown Source)
    at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Exception: JNLPException[category: System Configuration : Exception: null : LaunchDesc: 
<jnlp spec="1.6" codebase="http://localhost:8080/docRuleTool/appletjars/" href="http://localhost:8080/docRuleTool/appletjars/dynamictree-applet.jnlp">
  <information>
    <title>dynamictree</title>
    <vendor>dynamic</vendor>
    <homepage href="null"/>
  </information>
  <update check="background" policy="always"/>
  <resources>
    <java href="http://localhost:8080/docRuleTool/appletjars/" version="1.6"/>
    <jar href="http://localhost:8080/docRuleTool/appletjars/dynamictree.jar" download="eager" main="true"/>
    <jar href="http://localhost:8080/docRuleTool/appletjars/prefuse.jar" download="eager" main="true"/>
  </resources>
  <applet-desc name="dynamictree-applet" main-class="com.vaannila.utility.dynamicTreeApplet.class" documentbase="http://localhost:8080/docRuleTool/" width="1000" height="1000"/>
</jnlp> ]

最佳答案

问题出在这一行:

<j2se version="1.6" href="http://localhost:8080/docRuleTool/appletjars/" />

Java Web Start 将尝试从 href 属性中给出的 URL 下载 Jre 1.6。更正后的版本如下:

<j2se version="1.6" href="http://java.sun.com/products/autodl/j2se" />

可以在此处找到示例 JNLP 文件:Distribute your Swing application via Java Web Start

关于java - 尝试使用 jnlp 部署 java applet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7234653/

相关文章:

java - 从 servlet 启动 applet

java - 何时使用 Action 而不是 ActionListener

java - 如何将 Netbeans 项目转移到 Eclipse 中?

java - 小程序数据库访问问题

java - 如何使用 .pfx 文件对 Java 小程序进行签名?

django - 如何在 LAN 上设置 Django 服务器

java.lang.UnsatisfiedLinkError : org. sqlite.core.nativeDB.open()

java - 如何读取java中字符之间的多个标记?

database - 我可以从 VS 数据库项目的部署后脚本中调用不同的 SQL 脚本吗

c++ - 我现在如何知道哪些 DLL 是 C++ 的一部分?