I am using ant to build a jar of my project in eclipse. I deploy that jar on tomcat. But whenever an exception happen in my code (which is inside jar), the error stack trace comes but the line number does not come -- instead it says unknown source.
How can I get the line numbers in error stack trace?
The attribute "debug" requires values of "true" or "false" and is translated to javac -g option.
When explicitly wanting to specify a argument to -g, you can do that by defining the
attribute "debuglevel" , which accepts "source", "vars" and other values (see ant task
documentation for more details).
Setting debug="true" and debuglevel="source" will attach the source but won't provide line
number informations, debuglevel="lines,vars,source" will give you the information
that you need.
You need to compile your jar with debug information. Specifically, you need to find the javac
task that compiles the classes that you later jar and add a debug="on"
attribute. Example:
<javac srcdir="${src}"
destdir="${build}"
classpath="xyz.jar"
debug="on"
source="1.4" />
Full details can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With