This discussion is archived
2 Replies Latest reply: Nov 4, 2011 4:32 PM by 893179 RSS

Java Applet Freezes - Java 7 Bug?

806936 Newbie
Currently Being Moderated
Hi,

We have an applet which open JFrame.
I updated Java from 1.6.0 to 1.7.0_01.
Then My Applet freeze when it calls JFrame.pack() method.

(I repoted this to a bug database.)

Windows XP,7 and IE

Thank you

---------------------
Steps to Reproduce:
---------------------
Compile MyApplet.java,MyFrame.java
Create Jar ("sample.jar")
Prepare different jarfile ("dummy.jar")
Add a different signature to two Jar files. (self signature)
Delete All user certificates with Java Console Panel .

Open Browser.
Run applet.
Click "Button A".

----------------------------------
source
----------------------------------
1.applet_test/MyApplet.java
----------------------------------
package applet_test;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class MyApplet extends JApplet implements ActionListener{

public void start() {
try {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
JButton button = new JButton("Button A");
button.addActionListener(MyApplet.this);
getContentPane().add(button);

} catch (Exception e) {
e.printStackTrace();
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}

public void actionPerformed(ActionEvent e) {
JFrame frame = new MyFrame();
frame.setVisible(true);
}
}
----------------------------------

2.applet_test/MyFrame.java
----------------------------------
package applet_test;

import java.awt.Font;

import javax.swing.JFrame;

public class MyFrame extends JFrame {

public MyFrame() {
super("Sample ");
setFont(new Font("Monospaced", Font.PLAIN, 14));
pack();
}

}
----------------------------------

<html>
<head><title>sample</title></head>
<BODY>
<object
     width="50%"
     height="80%"
     classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93">
<PARAM NAME = "CODE" VALUE = "applet_test.MyApplet">
<PARAM NAME = "CODEBASE" VALUE = "/jar/">
<PARAM NAME = ARCHIVE VALUE = "sample.jar,dummy.jar">
<PARAM NAME = "type" VALUE = "application/x-java-applet;version=1.4">
<PARAM NAME = "cache_option" VALUE = "Plugin">
<PARAM NAME = "cache_archive" VALUE = "sample.jar,dummy.jar">
</body>
</html>
  • 1. Re: Java Applet Freezes - Java 7 Bug?
    gimbal2 Guru
    Currently Being Moderated
    Good that you reported it then. One thing I notice:
    <PARAM NAME = "type" VALUE = "application/x-java-applet;version=1.4">
    Hm? Version=1.4? That doesn't seem right, unless you compiled it for Java 1.4.
  • 2. Re: Java Applet Freezes - Java 7 Bug?
    893179 Newbie
    Currently Being Moderated
    I've tried your test case and the procedure but couldn't reproduce the hang with the following config:

    XP/IE8/jre7u1-b08

    x86 Win 7(sp1)/ IE 9/ jre 7u1-fcs

    I've noticed a slight problem in the test case - in the html file, it has

    <PARAM NAME = "CODEBASE" VALUE = "/jar/">

    I needed to remove the first '/' to make it work, i.e. to the following:

    <PARAM NAME = "CODEBASE" VALUE = "jar/">

    otherwise it'll try to load the jar from /jar/sample.jar instead of from ${docbase}/jar/sample.jar

    Could you modify the html file as described above and re-run the test case?

Legend

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