2

Using Command line edition for Processing 0269 (Java Mode) running in macOS 10.14.6's Terminal.app.


I'm using processing-java to run a Processing program which is producing an error. Accordingly the following stack trace is printed:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at processing.core.PApplet.runSketch(PApplet.java:10845)
    at processing.core.PApplet.main(PApplet.java:10613)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at processing.core.PApplet.runSketch(PApplet.java:10839)
    ... 1 more
Caused by: java.lang.NullPointerException
    at treibsand$Runtime.averageHistory(treibsand.java:72)
    at treibsand$Analyzer.<init>(treibsand.java:204)
    at treibsand.<init>(treibsand.java:105)
    ... 6 more

Now this information would probably be useful if it weren't for the literal ... 6 more being shown - instead of the rest of the stack trace.

The same stack trace is shown when running the program in the Processing IDE.

How can I see the entire stack trace?

Kevin Workman
  • 41,537
  • 9
  • 68
  • 107
Marcus Rossel
  • 3,196
  • 1
  • 26
  • 41

1 Answers1

1

Processing is not cutting anything off. This is part of the Java standard. Please see here for more info.

It shouldn't really matter though. The top of the stack trace almost always contains the information you're looking for. In your case, you're hitting a NullPointerException on line 72 of treibsand.java (which, by the way, should be named with an upper-case letter to follow standard naming conventions).

If you really need more information about exactly what's happening, then you can add your own logging just above that line and print out anything you want, including the full stack trace. But my guess is that won't actually help, as the problem is happening on the line at the top of your stack trace.

This could be caused by something like trying to use a Processing function before the sketch has been initialized. But again, that information will not be lower in the stack trace.

Kevin Workman
  • 41,537
  • 9
  • 68
  • 107