aspose file tools*
The moose likes Beginning Java and the fly likes getDocumentBase in non-main class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getDocumentBase in non-main class" Watch "getDocumentBase in non-main class" New topic
Author

getDocumentBase in non-main class

Dan Poltawski
Greenhorn

Joined: Nov 26, 2002
Posts: 4
I am trying to use getDocumentBase() in an object I have created.
However, it doesnt work.
I does work in my main class.
(this is an applet).
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Is the class that you are calling getDocumentBase() from in a different directory from your "main" class, and where exactly is your document in relationship to those two directories?


"JavaRanch, where the deer and the Certified play" - David O'Meara
le taylom
Ranch Hand

Joined: Dec 01, 2000
Posts: 44
Errrmmm, that's a pretty confusing question?!?! If you try and add a little more detail, maybe with some code we can all make a decent attempt at answering it.
T
Dan Poltawski
Greenhorn

Joined: Nov 26, 2002
Posts: 4
The getDocumentBase(), is in an object, which is being called by the main class.
Both are in seperate directories.
If I call getDocumentBase() in the main class, it work. However if called in the sub-class (which is the object).
It doesnt work, possibly becasuse its not actually in the base.
Im sorry, Im bad at explaining, but code wouldnt help, its just calling of getDocumentBase() doesntwork in a sub-class.
Dan Poltawski
Greenhorn

Joined: Nov 26, 2002
Posts: 4
I think the problem is that the getCodeBase() method is specific to Applet.
Does anyone have a workaround to get this to work on a subclass (which isnt an applet).
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
What exactly is it that you are trying to accomplish?
Dan Poltawski
Greenhorn

Joined: Nov 26, 2002
Posts: 4
Originally posted by Cindy Glass:
What exactly is it that you are trying to accomplish?

Display a picture via an external object
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Call getDocumentBase() in the main class and make sure that it is visible to the subclass. For instance you could put it in a static variable.
(Of course you already KNOW what package your subclass is in . . .)
[ November 27, 2002: Message edited by: Cindy Glass ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: getDocumentBase in non-main class