The AppletViewer (in /usr/local/java/latest/bin) fails to load the LoadInnerClassBug applet below, which contains an anonymous inner class. I got the following error message from AppletViewer [56]: /usr/local/java/latest/bin/appletviewer LoadInnerClassBug.html java.lang.UnknownError: LoadInnerClassBug$1 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java) at LoadInnerClassBug.init(LoadInnerClassBug.java:14) at sun.applet.AppletPanel.run(AppletPanel.java:273) at java.lang.Thread.run(Thread.java) The applet's source file was compiled as: /usr/local/java/latest/bin/javac LoadInnerClassBug.java Compilation finished at Sun Dec 29 14:38:27 Applet's source and html file: ---------------- LoadInnerClassBug.java ---------------- import java.awt.*; import java.awt.event.*; public class LoadInnerClassBug extends java.applet.Applet { static final String SHOW_NEW_FRAME = "Show New Frame"; int frameCounter; Button showButton = new Button(SHOW_NEW_FRAME); /** Builds the applet's interface. */ public void init() { add(showButton); showButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { /* Use conditional to work around inlining bug (#4023605) */ if (SHOW_NEW_FRAME.equals(showButton.getLabel())) { doSomething(); } } }); } void doSomething() { ++frameCounter; } } ---------------- LoadInnerClassBug.html ---------------- <html> <head> <title>LoadInnerClassBug</title> </head> <body> <strong>LoadInnerClassBug</strong> -- here's what it does ... <br> <hr> <applet code="LoadInnerClassBug.class" width=480 height=240> </applet> <hr> <a href="LoadInnerClassBug.java">The source.</a> </body> </html>
|