PRB: Stack backtrace does not work
Notice Information in this article applies to Excelsior JET version 4.0 and above. For versions 3.5 through 3.7, see article #15.
A JET-compiled application does not print stack backtrace to standard output when an uncaught exception is thrown by one of its threads or when a
printStackTrace() method is called explicitly. Instead, several "fake" elements are printed:
Exception in thread ... at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source)
By default, the stack backtrace is disabled in the JET Runtime. Respective methods of the
java.lang.Throwable class, such as
getStackTrace(), return and print a fake stack trace consisting of
Using the JET Control Panel, you may select the desired level of stack trace support on the Target page, in the Stack Trace Support combobox. Do not forget to recompile the application after changing this setting.
Note: Enabling stack trace may negatively impact performance, if exceptions are thrown and caught repeatedly.
Another way to enable stack trace is to set the
jet.stack.trace system property, for instance:
SET JETVMPROP=-Djet.stack.trace MyJavaApp.exe
It has the same effect as the setting of Stack Trace Support to Minimal in the JET Control Panel. It enables printing of the stack traces that contain only class names. If you need a detailed information including method names and line numbers, add this option
to the beginning of the project file and recompile your application.
Note: The side effect of setting
GENSTACKTRACE ON is the substantial growth (20% or more) of the resulting executable size.
Enabling the option
-GENSTACKTRACE+ along with the property
jet.stack.trace is similar to the setting of Stack Trace Support to Full in the JET Control Panel.
- Excelsior JET User’s Guide (https://www.excelsior-usa.com/doc/jet/jetw.html), Chapter “Application considerations”, section “Java system properties”.
- Excelsior JET User’s Guide (https://www.excelsior-usa.com/doc/jet/jetw.html), Chapter “Application considerations”, section “Stack trace”.
Article ID: 24
Last Revised On: 28-Sep-2005