通过Java Web Start(JNLP)启动的Applet启动两次

Jus*_*les 6 java jnlp applet java-web-start

我正在通过JNLP和Java Web Start启动applet.我的问题是,当页面加载时,两个JVM将启动两个Java控制台弹出窗口和两个"你想运行这个应用程序吗?" 弹出窗口.除此之外,applet最终加载,甚至我的本机库都正确加载.我不确定导致双重发射的原因.

编辑:此外,第一个加载的JVM在大约30-45秒后自动关闭.

HTML

<script>
var attributes = { code:"com.osgi.swpc.applet.TrackerApplet.class", width:770, height:825};
var parameters = {jnlp_href: "tracker-applet.jnlp"};
deployJava.runApplet(attributes, parameters, "1.6");
</script>
Run Code Online (Sandbox Code Playgroud)

JNLP

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" href="">
    <information>
        <title>Tracker</title>
        <vendor>My Vendor</vendor>
    </information>
    <resources os="Windows">
        <!-- Application Resources -->
        <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
        <jar href="tracker_applet.jar" main="true" />
        <nativelib href="applets/jacob.jar"/>
        <nativelib href="applets/com4j.jar"/>
    </resources>
    <applet-desc 
         name="Tracker Applet"
         main-class="com.osgi.swpc.applet.TrackerApplet"
         width="770"
         height="825">
     </applet-desc>
     <update check="background"/>
</jnlp>
Run Code Online (Sandbox Code Playgroud)

use*_*704 0

嗯...有趣的问题

我不太确定,因为有更多细节就好了......但我第一眼看到,我注意到你指出了主类重复:

...在JS中

var attributes = { code:"com.osgi.swpc.applet.TrackerApplet.class", width:770, height:825};
Run Code Online (Sandbox Code Playgroud)

然后在JNLP中

main-class="com.osgi.swpc.applet.TrackerApplet"
Run Code Online (Sandbox Code Playgroud)

所以请尝试只有一个主类属性。最好将其保留在 JNLP 中并再次尝试启动;


如果您有其他问题详情请评论

报告是否有帮助