• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting the document base from an Applet

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I keep getting a null pointer exception when I run the foolowing code from my applet


Can Anyone please advice me on what I could be doing wrong. THanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When do you get the Exception - during "this.getDocumentBase()" or during "new URL(...)"?

The javadocs say that getDocumentBase returns the full URL, including the HTML filename, and that during "new URL" the "spec" parameter is appended to the "context" parameter if it is not absolute (which yours isn't), so you likely are constructing an invalid URL.

Just curious: Do you really have a servlet configured to listen to requests into the applet directory?
reply
    Bookmark Topic Watch Topic
  • New Topic