Linked Questions
72 questions linked to/from How can I get the current stack trace in Java?
5 votes
2 answers
10k views
java: printing current backtrace [duplicate]
is there a way to add a command in Java to add the current backtrace ? I'm writing a red5 application and the appDisconnect function is being called twice. whenever a user changes room. I want to add ...
2 votes
3 answers
4k views
Generate a Java stacktrace at any point in the program [duplicate]
Possible Duplicate: Get current stack trace in Java I have a method that saves messages to a file. This method is called from many different parts of my main program. Is there any way that I can ...
2 votes
1 answer
621 views
In Java how to display function parameters when the function is called at much higher level? [duplicate]
For practicing algorithm questions, I set up my Java code like: ProblemClass.java public static void main(String[] args) { Solution solution = new ProblemClass().new Solution(); Utils....
-1 votes
1 answer
791 views
Get stacktrace of function with throws Exception [duplicate]
Lets say I have a function like this public JSONObject parseMessage(InputStream fileName) throws Exception { And it throws an error where can I get the stack trace of that? I know if I have ...
0 votes
1 answer
171 views
Is there any way i can get the list of called methods in a class in java? [duplicate]
Possible Duplicate: Get current stack trace in Java Here is the thing, i want to get a list of all called methods in a java class. So far i've been using eclemma, but that just insn't enough. I ...
0 votes
0 answers
112 views
How to get the Parent Class name irrespective of the Hierarchy [duplicate]
I have a classes in my project with the following structure Class A Class B Class C Under Class C.... I have the function mention below public static String getCallingClassname() { ...
1 vote
0 answers
67 views
Method Call Stack in Java [duplicate]
I want to create a method such that if i call that from any class it should get the class name from which the method has been called and can also print the class name.
1 vote
0 answers
63 views
Call stack from within Java method [duplicate]
Is it possible to add debugging code in a Java method which would determine which client method invoked that particular method using perhaps reflection, in very much the same way the call stack is ...
151 votes
9 answers
119k views
Java / Android - How to print out a full stack trace?
In Android (Java) how do I print out a full stack trace? If my application crashes from nullPointerException or something, it prints out a (almost) full stack trace like so: java.io.IOException: ...
114 votes
3 answers
87k views
Print current stack trace in JavaScript
How do I print a stack trace from JavaScript? The answer How can I get a Javascript stack trace when I throw an exception? deals with throwing an exception, but I need to print stack traces to debug ...
13 votes
8 answers
807 views
Java or any other language: Which method/class invoked mine?
I would like to write a code internal to my method that print which method/class has invoked it. (My assumption is that I can't change anything but my method..) How about other programming languages?...
19 votes
7 answers
5k views
Getting different results for getStackTrace()[2].getMethodName()
For logging purposes, I created a method logTitle() that prints out the calling method name for our TestNG tests. Sample code is below. @Test public void test1() throws Exception { method1(); } ...
15 votes
8 answers
8k views
Rescuing a swallowed Exception in Java
Some 3rd party library swallowed an Exception: String getAnswer(){ try{ // do stuff, modify instance state, maybe throw some exceptions // ... return computeAnswer(); ...
13 votes
4 answers
5k views
Outside classes accessing package-private methods
Suppose I have a class in my package org.jake and it has a method with default access (no modifier). Then the method is visible inside the package only. However, when someone receives the jar of my ...
18 votes
2 answers
5k views
Finding Source of Thread Creation in a Java application
I am working on a Java application which has a threading issue. While using the applications for some time with Netbeans profiler attached, I can see several threads are created. Most of them finish ...