Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2009
    Posts
    6
    Rep Power
    0

    Default Whats Wrong? Errors when compiling

    Hi
    Could someone have a look at my program I've attached and run it. It comes up with some error messages when compiling theres no red lines in the code though. I'm not 100% what the error messages are. any help would be appreciated.
    Cheers
    Dan
    Attached Files Attached Files

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Post the error messages, and the code (in code tags) around where they are being raised.

    Many people won't download stuff from forums.

  3. #3
    Join Date
    Feb 2009
    Posts
    6
    Rep Power
    0

    Default

    Thats what comes up when I try to compile and run the program


    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(ImageIcon.java:167)
    at finalpkg.gameScreen.<init>(gameScreen.java:28)
    at finalpkg.gameScreen$7.run(gameScreen.java:226)
    at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 597)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:122)

  4. #4
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    Crap I had this error on my final project and I'm trying to remember how to fix it. I would get this error in my calculator when I would try to press the = button. It has something to do with listeners on your button trying to access data elsewhere(in my case a BigInteger currentEntry) and manipulating it with other data.

    Sorry if that's not much help. The NPE in your event queue has nothing in spot 0. I'm assuming you have a list and loop somewhere? Try changing the starting position to 1 instead.
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Quote Originally Posted by software_dude_2009 View Post
    Thats what comes up when I try to compile and run the program


    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(ImageIcon.java:167)
    at finalpkg.gameScreen.<init>(gameScreen.java:28)
    at finalpkg.gameScreen$7.run(gameScreen.java:226)
    at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 597)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:122)
    Well, if you're getting a Null Pointer there then, looking at the ImageIcon code (since you haven't posted the relevant bit of yours), I'm guessing the URL handed to the constructor is null? Of course we might have different versions of Swing...so that might not be the right bit.

  6. #6
    ron87 is offline Member
    Join Date
    Mar 2009
    Posts
    52
    Rep Power
    0

    Default

    just debug stepwise you r trying to access null object somewhere....

Similar Threads

  1. Whats wrong with this code?
    By bbtgirl in forum New To Java
    Replies: 2
    Last Post: 02-25-2009, 04:51 AM
  2. whats wrong with this class declaration?
    By blossompark in forum New To Java
    Replies: 5
    Last Post: 11-30-2008, 03:18 AM
  3. Whats wrong with my maths???
    By soc86 in forum New To Java
    Replies: 4
    Last Post: 11-03-2008, 06:52 PM
  4. Cannot understand whats wrong
    By Lehane_9 in forum New To Java
    Replies: 1
    Last Post: 03-06-2008, 08:57 PM
  5. Whats wrong with my code???
    By Soda in forum New To Java
    Replies: 2
    Last Post: 12-06-2007, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •