• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null pointer Exception getcodebase()

 
karunakaran Perumal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai ,excuseme i new one to this forum.so i don't know abt previous posts.
I urgently need solution for my problem.

this is my program


public static void main(String args[])
{
CheckApplet c =new CheckApplet();

String str=c.getCodeBase().getHost();
System.out.println(str);
}

at java.applet.Applet.getCodeBase(Applet.java:136)
at CheckApplet.main(CheckApplet.java:17)

plz give me solution for this problem
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

getCodeBase() is implemented by calling out to another class in the applet package, "AppletStub". The browser provides an AppletStub object by calling the Applet's setStub() method when the Applet is created. If you want to use an applet outside of a regular container, and that applet needs to use any of the methods whose implementations depend on there being an AppletStub, then you have to implement an AppletStub subclass yourself and call Applet.setStub() to register it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic