Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to find out a method caller

Posted on 1997-08-29
2
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
russgold earned 100 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

704 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