Base from StaticBase.run(StaticBase.java:9) Base from StaticBase.run(StaticBase.java:9) Here......! Derived from StaticBase$Derived.run(StaticBase.java:22) Base from StaticBase.run(StaticBase.java:9) Derived from StaticBase$Derived.run(StaticBase.java:22) Derived from StaticBase$Derived.run(StaticBase.java:22)
Base from com.StaticBase.<clinit>(StaticBase.java:5) Base from com.StaticBase.main(StaticBase.java:27) Here.....! Derived from com.StaticBase$Derived.<clinit>(StaticBase.java:15) Base from com.StaticBase$Derived.<clinit>(StaticBase.java:16) Derived from com.StaticBase$Derived.<clinit>(StaticBase.java:17) Derived from com.StaticBase.main(StaticBase.java:29)
it is producing sys out in run method and from where that method is been called i mean line number of caller.
Thread.currentThread().getStackTrace() returns an array of StackTraceElement, StackTraceElement object is used to represent single stack frame [ August 28, 2008: Message edited by: ramesh maredu ]
SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
OK now I get the same output....I actually didn't see that it has an inner class.I was actually running the code with the name of the inner class i.e. Derived...and I was getting this error
Exception in thread "main" java.lang.NoClassDefFoundError: Base (wrong name base) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source)
but I don't understand how I was getting this exception??? [ August 28, 2008: Message edited by: Ankit Garg ]
"An element in a stack trace, as returned by Throwable.getStackTrace(). Each element represents a single stack frame. All stack frames except for the one at the top of the stack represent a method invocation. The frame at the top of the stack represents the execution point at which the stack trace was generated. Typically, this is the point at which the throwable corresponding to the stack trace was created."
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.