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 4 of 4

Thread: [B]Null Pointer Exception[/B]-- Please Help!!!

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default [B]Null Pointer Exception[/B]-- Please Help!!!

    I am having a null pointer exception while reading a file,Below is the code:

    private static final String TASK_CUBES_PIECE_DEFINITIONS_PATH = "/task/src/cubes/definitions/";
    InputStream is = PieceCollectionFactory.class .getResourceAsStream(TASK_CUBES_PIECE_DEFINITIONS_ PATH + getCollection() + "-set.piece");
    BufferedReader reader = new BufferedReader(new InputStreamReader(is));


    Please help me out!


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: [B]Null Pointer Exception[/B]-- Please Help!!!

    Which line is the NPE on? Have you stepped through this with a debugger to figure out which value is null? Have you at least added print statements to figure out which value is null? There's really not much we can go on with three lines of code.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: [B]Null Pointer Exception[/B]-- Please Help!!!

    InputStream 'is' is giving NPE

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: [B]Null Pointer Exception[/B]-- Please Help!!!

    So now your job is to track down why is is null, using the same process of stepping through it with a debugger and adding print statements.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Help with null pointer exception
    By Dr.HughMan in forum Exceptions
    Replies: 35
    Last Post: November 30th, 2011, 09:00 PM
  2. Null Pointer exception
    By Demetrius82 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 2nd, 2011, 07:32 PM
  3. Null Pointer Exception Help !!
    By AlterEgo1234 in forum Member Introductions
    Replies: 1
    Last Post: March 27th, 2011, 10:07 AM
  4. Null Pointer Exception Help!!
    By puzzledstudent in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 11th, 2010, 06:46 PM
  5. Null Pointer Exception
    By MysticDeath in forum Exceptions
    Replies: 2
    Last Post: October 24th, 2009, 01:49 PM