File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Stack Trace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Stack Trace" Watch "Stack Trace" New topic

Stack Trace

Natraj Gudla
Ranch Hand

Joined: Feb 09, 2003
Posts: 34
When i capture an exception and print a stack trace, it prints even the line in the function where it was thrown.Does this line number show the actuall number in the source file or in the compile file(that is the byte code).
as i am unable to relate to the line number in the trace and the same in the source file.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
It's the line number in the source file. You may be seeing some of the core API library source file line numbers. If you will post the stack trace and indicate the line that is confusing you maybe we can figure it out.

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
Dear Nataraj,
1-public class Test1
3-public static void main(String args[])
5- int a[]=new int[5];
6- System.out.println(a[6]);

F:\Programs\Java\General>java Test1
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at Test1.main(
So as the above example says there was a problem at line 6 and thus the line number is the linbe # of Source file.
I agree. Here's the link:
subject: Stack Trace
Similar Threads
Method that returns a vector
Unknown Source
Why???? (Unknow Source)
Ant Unknown Source?????