15

I'd like to learn how, or if its possible at all to programmaticly interact with a black-box java application(by reading its data). Has there been any previous research/work on doing this sort of thing?

I'd imagine that running on a JVM significantly complicates things.

@anon: Doing this with any JVM is relevant. Do you have to know or control the specifics of how the JVM allocates memory to extract data from a java application?

3
  • 1
    Running on an arbitrary JVM, or a particular commercial JVM, or on a JVM you've developed especially for this purpose? Running on a virtual machine instead of a real one makes things easier if you control the VM internals, and even if you don't, it doesn't make it any harder as long as you know what those internals are. Commented Jun 29, 2010 at 4:39
  • A related thread that should apply here: stackoverflow.com/questions/2771868/… Commented Jun 29, 2010 at 4:44
  • 1
    Maybe the debugger interface helps java.sun.com/j2se/1.3/docs/guide/jpda/jvmdi-spec.html Commented Jun 29, 2010 at 5:42

5 Answers 5

3

You could look into java.lang.instrument. As long as you understand the class structure of the application, it will let you modify the methods in an already-running JVM and you may be able to concoct a way that allows you to extract or insert data enough to communicate (depends on the methods available, of course).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I had never heard of this and it looks promising. I imagine using it in conjunction with the profiling tools other answers have mentioned could be helpful as well.
1

The Sable group at McGill University has contributed a lot of research to the Java world.

Much of the work is getting rather dated, but you might find some help in their EVolve project which has the goal of visualizing object-oriented programs. Some of their projects appear to be actively maintained (such as Soot, their Java optimization framework), so you might find luck contacting them directly

Comments

1

It is easily possible with, for example, StackTrace. It can attach to a java process and let you inspect and change almost everything with BeanShell.

1 Comment

Looks like that link is broken?
0

I believe what you're looking for is what the Eclipse MAT does. You might want to take a look at the source code...

Comments

0

The HotSpot JVM allows you to hook up an agentlib from a profiler (see Open Source Java Profilers or commercials like Your Kit), in the profiler you can then inspect the memory/cpu/threads etc. If you want very specific stuff you might want to make your own agentlib that sends you information about the jvm that you need.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.