File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

GetDocumentBase always returning null

Ricardo Prado

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: 60

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

I agree. Here's the link:
subject: GetDocumentBase always returning null
jQuery in Action, 3rd edition