Name: gsC80088 Date: 03/10/99
java.lang.IllegalAccessError: test.base.TestClassA.class$java$lang$String
is thrown in the simple case below.
The inclusion of the static is important.
The applet MUST be downloaded from a webserver
Using Class.forName(String) works OK.
Classes:
TestApplet
==========
package test;
import java.applet.*;
import test.sub.TestClassB;
public class TestApplet extends java.applet.Applet {
public void init() {
System.out.println("Running Test Applet");
System.out.println("Creating ");
new TestClassB();
System.out.println("Done");
}
}
TestClassA
==========
package test.base;
public class TestClassA extends java.lang.Object {
public static java.lang.String DEFAULT_STRING = "";
public TestClassA() {
System.out.println("In constructor of TestClassA");
System.out.println(String.class.getName());
System.out.println("End constructor TestClassA");
}
}
TestClassB
==========
package test.sub;
import test.base.TestClassA;
import java.lang.*;
public class TestClassB extends test.base.TestClassA {
public TestClassB() {
System.out.println(String.class.getName());
}
}
Stack Trace
===========
java.lang.IllegalAccessError: test.base.TestClassA.class$java$lang$String
at test.sub.TestClassB.<init>(TestClassB.java:8)
at test.TestApplet.init(TestApplet.java:12)
at sun.applet.AppletPanel.run(AppletPanel.java:287)
at java.lang.Thread.run(Thread.java:474)
(Review ID: 41266)
======================================================================