View Single Post
  #7 (permalink)  
Old 12-07-2007, 01:36 PM
Thez Thez is offline
Member
 
Join Date: Dec 2007
Posts: 13
Thez is on a distinguished road
Another problem now, using images by classpath.
I use the Toolkit.getImage() and it will work fine if I use a full path (e.g ""C:\Documents\Thez\test.jpg") but if I try to use a classpath it gives an 'Uncaught error fetching image: NullPointerException'.

My project has two packages, 'core' and 'images'.
I tried with a simple JLabel from NetBeans and it uses 'getClass().getResource("/images/test.jpg")' and the label shows the image just fine.

If I try Toolkit.getImage(getClass().getResource("/images/test.jpg")); it gives the error.

Any idea what I'm doing wrong?
Reply With Quote