• Post Reply Bookmark Topic Watch Topic
  • New Topic

NPE Problem  RSS feed

 
matthew peter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I cannot for the life of me figure out why this keeps throwing a NPE. Here is the code maybe you guys can help me out.







This is the error I get on compile time


run:
*** JPiReporter v0.0.1 ***
Exception in thread "main" java.lang.NullPointerException
Matthew P. Christensen © 2015
contact with bugs at jpireporter.bugs@gmail.com.
Please put the word BUG in subject line with any errors or
exceptions given.




Wed Jul 29 00:55:53 EDT 2015: Loading properties file(s)...
Wed Jul 29 00:55:53 EDT 2015: Loading properties complete. at jpir.start.PropertiesHandler.getPorgramProperties(PropertiesHandler.java:35)
at jpir.start.FirstStart.start(FirstStart.java:22)
at test_runner_generi.Test_Runner_Generi.main(Test_Runner_Generi.java:19)
Java Result: 1
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try changing line 49 to e.printStackTrace() and it will tell you which line threw the exception.

Did you lose interest in your earlier question?
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On taking a closer look I see you have posted interspersed out and error messages.
at jpir.start.FirstStart.start(FirstStart.java:22)

Line 22 in the posted code is a variable declaration, and can't throw an exception. To get targeted help, you need to PostRealCode <- link
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult a question for “beginning”. Discussion moved.
 
Knute Snortum
Sheriff
Posts: 4274
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the these arrays are declared but never instantiated:

 
matthew peter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:It looks like the these arrays are declared but never instantiated:



Can you be more specific as to variable instantiated?.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do those arrays ever appear to the left of the = operator?
Your class needs a constructor, and you should initialise every non‑static field to a sensible value in the constructor. That means your object is in a consistent state, where all its invariants are established.

You should not initialise static fields in the constructor; either use a (static) initialiser or declare and initialise them on the same line.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!