This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the document base from an Applet

 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • 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
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic