1

I developed an applet and I reload it when it finishes some task. I accomplished that using javascript:

function startApplet() {
  // code to setup "object" tag
  var appletHtml = '<object name= ....'
  document.getElementById("applet_tag").innerHTML = appletHtml;
}

function restartApplet() {
  if (document.getElementById("applettag")) {
    document.getElementById("applet_tag").innerHTML = '';
  }
  startApplet();
}

That works perfectly in some machines but in others the javascript code is executed but the applet doesn't reload (disappear current instance, start a new one)

I already tried with <param name="cache_option" value="no"> or using jquery code to reset applet div with no success.

Anyone knows about this issue or knows another way to reload the applet without refreshing page?


Edit: More info about issue:

Looking at Java console, I infer that applet efectively restart, but I think I need that the applet restart in a new JVM instance. Below, I attached an extract of the java console:

basic: Applet loaded.
...
basic: Applet initialized
basic: Starting applet
...
basic: Applet started
basic: Told clients applet is started
basic: Starting applet teardown
basic: Finished applet teardown
basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@d062ed
basic: PluginMain.unregisterApplet: 1 from mananger sun.plugin2.applet.Applet2Manager@ca5165

basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@185c219
basic: Plugin2ClassLoader.addURL parent called for http://...
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 359544 us, pluginInit dt 55298741 us, TotalTime: 55658285 us
Applet inicializado
basic: Applet initialized
basic: Starting applet
basic: completed perf rollup
basic: Applet made visible
basic: Applet started
basic: Told clients applet is started
1

2 Answers 2

1

I found the solution in applet in new jvm, using separate_jvm applet parameter, official deployment documentation in applet deployment. Thank you.

Sign up to request clarification or add additional context in comments.

Comments

0

instead of directly calling startApplet put it on a 15 second timeout. That will allow the jvm to exit.

function restartApplet() {
    if (document.getElementById("applettag")) {
        document.getElementById("applet_tag").innerHTML = '';
    }
    setTimeout("startApplet()", 15000);

}

New JVM Not tried this but you could

var apltIdCnt = 1
function startApplet() {
    // code to setup "object" tag
    var appletHtml = '<div id=aplInner'  + apltIdCnt + ' <object name= ....'
    document.getElementById("applet_tag").innerHTML = appletHtml;
    apltIdCnt += 1 ;//or apltIdCnt++
}

this might help if other tags have a different jvm

4 Comments

Thank you tgkprog, but the issue is still present. In my post I added some extra info.
not sure about a new jvm. can you put a new simple applet on same page and run in same browser and see if it has 2 jvms? then maybe you need to make a new div tag (with a new id); see edit in answer
I tried with different tag id with no change in result. Thank you anyway.
i see you found a solution and it was part of the API - great!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.