GeeCON Prague 2014*
The moose likes Applets and the fly likes GetDocumentBase always returning null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "GetDocumentBase always returning null" Watch "GetDocumentBase always returning null" New topic
Author

GetDocumentBase always returning null

Ricardo Prado
Greenhorn

Joined: Oct 01, 2010
Posts: 13
Hello everyone,

I'm using the method "getDocumentBase()" to get the url where my applet is deployed, but this method ALWAYS returns null!

I've already tried using it inside the init or start method. It always returns null, I have no idea why.


If I use it inside the start method, the Applet draws itself and then it broke(nullpointer exception because I tried to use the URL returned by getDocumentBase)

What can I do?
binu narayanan
Ranch Hand

Joined: Jul 24, 2009
Posts: 56
Hi,

You use the following code

URL base = getDocumentBase();

in your init() method. It shoul return the applet document value.

If still with issue kindly post your code

Binu
 
GeeCON Prague 2014
 
subject: GetDocumentBase always returning null