I get a NullPointerException
on the following statement when I run my code in Eclipse 3.6.1:
private ImageIcon initialicon = new ImageIcon(gbarsStatusPlusTest.class.getResource("/images/waitingLight.GIF"));
I've read through posts with similar questions and tried the answers with no luck, including:
- Using the absolute path
- Using various relative paths
- Putting the gif in various folders (src, bin, lib, etc)
- Creating waitingLight.gif->waitingLight.GIF link
My current project path to the image is LosOMeter->src->images->waitingLight.GIF.
Any ideas?
Stack trace:
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at javax.swing.ImaqeIcon.<init>ImaqeIcon.java:205)
at geolosmeter.gbarsStatusPlusTest.<init>(gbarsStatusPlusTest.java:85)
at geolosmeter.gbarsStatusPlusTest$5.run(gbarsStatusPlusTest.java:2848)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventlmp(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccesslmpl.dolntersectionPrivilegeProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at java.awt.EventDispatchThread.pumpOneEventForFilter(EventDispatchThread.java:18)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:133)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:22)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:118)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:110)
at java.awt.run(EventDispatchThread.java:91)