Solved

How to find out a method caller

Posted on 1997-08-29
2
215 Views
Last Modified: 2010-04-16
How to find out from which method was method called from ?
For example if method A calls method B, how can I find, that method B was called from A. And is it possible to find out on the level of bytecode?
0
Comment
Question by:Klemo
2 Comments
 
LVL 4

Accepted Solution

by:
russgold earned 50 total points
ID: 1226006
There is a solution, but it doesn't work when running under a JIT:  You can use Throwable.printStackTrace to print the current stack to a BufferedOutputStream and then parse the result to find the calling method's name.  The problem is that in a JIT, the Java stack information is not preserved.  
0
 

Author Comment

by:Klemo
ID: 1226007
I knew that already, I find it out whit playing with that stuff, but thanks anyway.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 236
How to execute a Python program and gather return output in Java 2 49
Eclipse with various Java releases 7 43
What browser will run Java? 7 122
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question