Use the following java option to have a more verbose exception message especially for NullPointerException:

-XX:+ShowCodeDetailsInExceptionMessages

For example, if we have the following snippet:

var a = null;
a.b = 1;

Running the above snippet will have the following exception:

Exception in thread "main" java.lang.NullPointerException: Cannot assign field "b" because "a" is null

Note: This is more useful if the classes were compiled with debugging info (i.e. javac -g )