• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting getCodeBase() to work consistently...

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Happy New Year.
I've an applet which accesses some local files for display in a JEditorPane.
I've also used both getCodeBase() and getDocumentBase() before for these purposes (as well as hard-coded a few url's. I believ I understand it well, but now I have getCodeBase() working in one applet but not compiling in another applet, with this compile time error:

cannot resolve symbol
method getCodeBase()
location class ExplanatoryText
...java.net.URL url = new java.net.URL(getCodeBase() + "junk.html");

Following is the code snippet which doesn't compile (why?)

And yet in so many of my other applets, they work well, like this little demo of mine that I use as a sort of template for other applets...

This work well.
Can someone shed some light on this seeming inconsistency for me please.
TIA :-)
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, it does now, I was extending the wrong class, should have extended JApplet. Was a long programme, can miss a lot of things.
Sorry for taking up your time.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!