Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

NullPointerException on getResource() only in browser

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, i'm writing here because i'm really getting sick on a strange problem with my applet...


I made this simple applet:




This is the HTML tag:



The attachment shows what does my jar contain..

The problem is that everytime i try to execute my applet in my IDE, everything works.

BUT: when trying to execute applet in browser, i get everytime a NullPointerException right here:

java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)



That is:



Please can you help me to solve this? I'm really sure the path is correct, what should i do??? Do i have to modify my classpath file or Manifest?

Really thanks for your help.

P.S= Sorry for my bad english, i'm italian.
Immagine.png
[Thumbnail for Immagine.png]
 
Francesco Rizzi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOLVED... Running the applet from the local file html would have access denied to local files...

uploading the applet on a website everything works, my fault...
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch and thank you for updating the thread with the solution.
 
Francesco Rizzi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Pleasure.
 
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic