Applets launched via Java Web Start (JNLP) launches twice
Asked Answered
N

3

6

I am launching an applet via JNLP and Java Web Start. My problem is that when the page is loaded, two JVMs will launch with two Java console popups and two "Do you want to run this application?" popups. Other than that, the applet ends up loading and even my native libraries are loaded properly. I'm not really sure what is causing the double launching.

EDIT: Also, the first loaded JVM automatically closes after about 30-45 seconds.

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>

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>
Nikolaus answered 7/1, 2013 at 21:21 Comment(5)
Is the missing " in the var attributes ... a typo or ?Axe
Yes, it was a typo. I've edited the question to make that clear.Nikolaus
@JustinSkiles: does this happen on all browsers?Replicate
Did you solve this somehow, I'm having the same issue...Intelsat
@Intelsat Nope. It's been a few years since I looked at this. I think we eventually just ignored it and it went away with upgrades to the JRE and browsers.Nikolaus
T
0

Emm... interesting question

I am not pretty sure because there would be fine to have more details... But at my first sight I can notice you point Main class duplicate:

... in JS

var attributes = { code:"com.osgi.swpc.applet.TrackerApplet.class", width:770, height:825};

and then in JNLP

main-class="com.osgi.swpc.applet.TrackerApplet"

So please try to have just one main class attribute. Preferably leave it in JNLP and try launch again;


If you have some additional question details comment please

Report if that helped

Tortola answered 15/4, 2013 at 17:6 Comment(0)
U
0

I'm not really sure what is causing the double launching.

It depends on the implementation of Java that you're using, but in recent version of the Oracle JRE (used to be Sun JRE), a WebStart application would:

  • cache the JNLP file
  • read the JNLP file to find the list of resources it need to download (these our normally your JARs)
  • construct a command to launch a normal Java application using the recently downloaded JARs
  • launch the Java application

(Note I'm not trying to give a full description of what Java WebStart does, but I just try to provide some insight into the process.)

This way, you first have a javaws executable, which runs pretty much as long as is required to download the JARs, followed by a java executable, which will execute the actual program.

Unprejudiced answered 30/6, 2014 at 9:49 Comment(0)
H
0

In case this happens with MSIE, just want to add a suggestion to disable "Smart Screen Filter" especially in situations where there is no/slow internet access.

The position where the option is depends on MSIE version, I think in MSIE 7 its directly in the Extras menu, while in 9 it's under security settings in the internet options.

Hartz answered 16/6, 2016 at 20:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.