• 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: 42970
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?
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!