This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Getting getCodeBase() to work consistently...

 
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic