A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
GetDocumentBase always returning null
Joined: Oct 01, 2010
Oct 15, 2010 13:20:55
I'm using the method "getDocumentBase()" to get the url where my
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?
Joined: Jul 24, 2009
Nov 27, 2010 03:00:35
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
It is sorta covered in the
JavaRanch Style Guide
subject: GetDocumentBase always returning null
how to use getDocBase() in Java
getDocumentBase() not working???
where to put image jar files
Read xml file placed on localhost
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013