Kal8578
Kal8578

Reputation: 151

How to know precisely where a NullPointerException comes from?

I'm writing some code in Java. I've got tons of classes that have subclasses that have subclasses ... You get it. At some point, when running my code, I have a NullPointerException. Eclipse tells me that it comes from a line of code that looks like :

Something1.Something2.Something3.Something4.Something5...

Where Something(n+1) is a field of Something(n).

My question is, do I have a way to know where is the NullPointerException exactly ? I mean, any of the Something(n) could be null and cause the Exception when I try accessing one of its fields.

Thank you by advance,

Kal8578

Upvotes: 1

Views: 59

Answers (1)

pafau k.
pafau k.

Reputation: 1687

You can get detailed info on NullPointerException only on JDK 14+.

Upvotes: 1

Related Questions