This discussion is archived
3 Replies Latest reply: Jun 8, 2012 10:54 AM by 941573 RSS

IE8-9 Java Applet: The java applet or JVM or Java.exe exits abruptly

941573 Newbie
Currently Being Moderated
I am running some JavaScript repeatedly (per our development requirement) on an applet which causes the applet or JVM to exit. I have an example page and my JavaScript code that can reproduce this issue.

Here are steps to follow to produce this issue:

1. Launch Internet Explorer (8/9).
2. Go to [http://csis.pace.edu/~bergin/Java/applets.htm] webpage
3. Open Developer Tools window (using F12 or Settings->F12 Developer Tools)
4. On the Developer Tools window select the "Console" tab
5. Type and run following Java Script in the console tab



// Java Script function to process the Applet component.
// This function recursively walks through the Chidren
// of a component and counts the number of components
// thre are in this applet.

var JavaAppletTest = {};
(function() {

JavaAppletTest.ProcessComponent = function(component)
{
     var childCount = 0;
if ('getComponentCount' in component)
{
          var childIndex = 0;
          for (childIndex = 0; childIndex < component.getComponentCount(); ++childIndex)
          {
               childCount++;
               
               if ('getComponent' in component)
               {
                    var childComp = component.getComponent(childIndex);
                    var childrenCount = this.ProcessComponent(childComp);
          
                    childCount = childCount + childrenCount;
               }
          }
}
     return childCount;
}

JavaAppletTest.ProcessJavaApplet = function (applet) {
     return this.ProcessComponent(applet);
};

})();

// Java Script function to process an applet multiple times using iteration.
function RunJavaScript() {
     // Process Applet 5000 times.
     var i = 0;
     for (i = 0; i < 5000; i++)
     {
// In the statement below "document.applet[2] refers to third applet on the page."
          console.log("Interval: " + i + " " + "Result: " + JavaAppletTest.ProcessJavaApplet(document.applets[2]));
     }
}



6. The above statement should define the JavaAppletTest global variable and also the RunJavaScript function
7. Now on the console tab call the RunJavaScript function

This should run the defined Java script function "RunJavaScript." This function supplies the third applet to the ProcessJavaApplet function of the JavaAppletTest global variable. The ProcessJavaApplet function recursively goes through the children of the applet and counts how many are there in the applet.

The above test is just small example of a small part of our development task which has issues as Java applet or JVM crashes.

Let me know how i can resolve this issue.

Thank you.

Edited by: 938570 on Jun 4, 2012 1:30 PM

Edited by: 938570 on Jun 4, 2012 1:33 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points