r/javahelp • • Sep 04 '16

GUI programming not working properly.

Why am I getting a null pointer exception? Netbeans is not flagging any errors after I've written the code. I'm getting a null pointer pointer exception, whatever that is.

Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:217) at LabelFrame.LabelFrame.<init>(LabelFrame.java:34) at LabelFrame.LabelTest.main(LabelTest.java:13)

Label Frame test class http://pastebin.com/d1bQ11ae Label Frame http://pastebin.com/UQGVNh2f

0 Upvotes

3 comments sorted by

View all comments

5

u/nutrecht Lead Software Engineer / EU / 20+ YXP Sep 04 '16

I'm getting a null pointer pointer exception, whatever that is.

And why did you not google "what is a null pointer exception"?

It means that you have an object reference somewhere you didn't actually assign an object to and then try to call a method on that 'empty' (null) reference. The stacktrace tells you exactly where it happens.