Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Exception in thread "main" java.lang.NullPointerException

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Exception in thread "main" java.lang.NullPointerException

    Pls help me i got this message when i compile my program


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Exception in thread "main" java.lang.NullPointerException

    got this message when i compile my program
    That is a very unusual error message to get when compiling a program.
    Normally you only get that error when executing a program.

    Please copy the full text of the error message and paste it here.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jan 2013
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Exception in thread "main" java.lang.NullPointerException

    Hi , at compile time it can not rise. whenever performing the any operations on null values it may be rise at run time.

  4. #4
    Junior Member
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Exception in thread "main" java.lang.NullPointerException

    Yes, you are right, the error occurs during run time. The output shows
    "Exception in thread "main" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(ImageIcon.java:205)
    at Login.<init>(Login.java:38)
    at Login.main(Login.java:100)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)"

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Exception in thread "main" java.lang.NullPointerException

    "Exception in thread "main" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(ImageIcon.java:205)
    at Login.<init>(Login.java:38)
    There is a variable with a null value at line 38 where the code is trying to create an ImageIcon.
    Check the code and make sure the variable does not have a null value there.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 5
    Last Post: December 9th, 2012, 02:25 PM
  2. Exception in thread "main" java.lang.NullPointerException problem.......
    By Adam802 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 20th, 2012, 02:23 AM
  3. Exception in thread "main" java.lang.NullPointerException
    By linux.sys in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 22nd, 2012, 06:01 AM
  4. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  5. Please help! Exception in thread "main" java.lang.NullPointerException
    By Arutha2321 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 18th, 2009, 02:25 AM