This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getDocumentBase in non-main class

 
Dan Poltawski
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
le taylom
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly is it that you are trying to accomplish?
 
Dan Poltawski
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic