尝试使用 jnlp 部署 java applet

发布于 2024-12-02 03:17:00 字数 4064 浏览 1 评论 0原文

我正在尝试使用 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> ]

i am trying to deploy applet using jnlp

my jnlp file :

<?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>

my applet code :

<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>

My javascript :

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

Error i am getting:

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> ]

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

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

发布评论

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

评论(1

黑凤梨 2024-12-09 03:17:00

问题出在这一行:

<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 文件可以在此处找到:通过 Java Web Start 分发您的 Swing 应用程序

The problem is with this line:

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

Java Web Start will try to download Jre 1.6 from the url given in the href attribute. Corrected version given below:

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

Sample JNLP file can be found here: Distribute your Swing application via Java Web Start

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