Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getCodeBase null pointer exception w/application

3 views
Skip to first unread message

Eric Cooper

unread,
Aug 28, 2000, 3:00:00 AM8/28/00
to
Anyone know why I get the following nullPointerException on getCodeBase()
with the "main" function I added (code snippet listed below) so as to make a
working applet callable from java.exe?

Any guidance is greatly appreciated!
Eric

Exception in thread "main" java.lang.NullPointerException
at java.applet.Applet.getCodeBase(Unknown Source)
at Test.start(Test.java:86)
at Test.main(Test.java:96)

public void start()
{
this.getCodeBase();
super.start();
}

public static void main (String []theArgs)
{
Applet app = new Test();
app.setVisible(true);
Frame frame = new Frame();
app.init();
app.start();
System.out.println("inited and started");
frame.add("Center",app);
System.out.println("frame added");
frame.setSize(680,470);
System.out.println("frame resized");
frame.setVisible(true);
System.out.println("showed");
}

Roger Lindsj|

unread,
Aug 30, 2000, 3:00:00 AM8/30/00
to

In order for an Applet to use gatCodeBase() etc it needs a valid
AppletContext. This is created by appletviewer or the browser running
your applet. If you want to run your applet as a stand alone program
you need to create your own AppletContext.

Roger Lindsjö


0 new messages