stack trace: why doens't it show the line number ?

W

Walter Stucki

Hi

Case a) JVM shows in the stack trace the line number if I'm running my
java application with class-files (e.g. ConsoleInput.java:182):

Case b) The JVM doesn't show the line number information if I'm
running the same application as a jar-file (It shows unknown source)

My questions:
- Is the reason for this behavior (doesn't show line number) because
the application is running as a jar?
- Is there a workaround to show the line number in the stack trace if
Im working with a jar?



--------------------------Case a)--------------------------------
$ java -classpath "C:\iqscanner\classes;" -showversion
ch.post.pf.eaipf.iqscanner.input.ConsoleInput -v:minor
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

19.12.2003, 12:46:34.345=[9]== {iq-scanner about ConsoleInput STARTED}
==
19.12.2003, 12:46:34.345=[5]== {verbose mode set} ==
error occured:
mode isn't set (required)
try "iqscanner -h" for more informations
java.lang.IllegalArgumentException: mode isn't set (required)
at ch.post.pf.eaipf.iqscanner.input.ConsoleInput.setApplicationProperties(ConsoleInput.java:182)
at ch.post.pf.eaipf.iqscanner.input.ConsoleInput.startApplication(ConsoleInput.java:98)
at ch.post.pf.eaipf.iqscanner.input.ConsoleInput.main(ConsoleInput.java:66)
============================================

--------------------------Case b)--------------------------------
$ java -classpath iqscanner.jar
ch.post.pf.eaipf.iqscanner.input.ConsoleInput
19.12.2003, 12:46:15.989=[9]== {iq-scanner about ConsoleInput STARTED}
==
19.12.2003, 12:46:15.989=[5]== {verbose mode set} ==
error occured:
mode isn't set (required)
try "iqscanner -h" for more informations
java.lang.IllegalArgumentException: mode isn't set (required)
at ch.post.pf.eaipf.iqscanner.input.ConsoleInput.setApplicationProperties(Unknown
Source)
at ch.post.pf.eaipf.iqscanner.input.ConsoleInput.startApplication(Unknown
Source)
at ch.post.pf.eaipf.iqscanner.input.ConsoleInput.main(Unknown
Source)
============================================
 
T

Thomas Kellerer

You need to compile your sources with the -g flag, in order to ge line numbers
in the class file

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,173
Latest member
GeraldReund
Top