Is it possible to read the memory of a running java application?

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?

Read memory of Java applet running inside browser

I use C# to program and use ReadProcessMemory to read the memory of other processes running on the system. However, I’m unsure how to read the memory of a java applet that is running inside a browser?

Java ~ Read external programs memory

I have the following case: I am writing a java program and I’d like to read inside of the memory of an external process (that is a process not started by my application) Is this (easily) possible? Do

Defining a class while a Java application is running

In Java, is it possible to create a class definition on the fly while an application is running, and then create an object of that class? For example, a running application would read in a text file t

Memory leak in a Java web application

I have a Java web application running on Tomcat 7 that appears to have a memory leak. The average memory usage of the application increases linearly over time when under load (determined using JConsol

Who read/write my application’s memory

Each Application has its memory space. In Windows, all process can use OpenProcess and ReadProcessMemory/WriteProcessMemory(NtReadVirtualMemory/NtWriteVirtualMemory) to read or write memory of app

Java Web Application – File Read

This question is related to Java Web Application – File Upload. Is it possible for a Web Application to read a file from the host file system? My guess is that for security reasons the answer is no

Java crashed application – how to find out why java crashed – possible memory problem

my java server started to crash repeteally, and I can’t find why. I have server with 7,5GB memory and I have alocated 3GB for java process. Server was running fine, did many times Garbage collection,

Windows: accessing driver memory from userspace (read only) – possible?

Is it possible in Win7 family to read a random known location at lower 4gb of RAM from userspace application? The memory at that location is allocated by kernel driver.

How to tell if java application is close to running out of memory

My simple goal: monitor the memory usage of a Java application so I can be warned when the application is getting dangerously close to throwing an OutOfMemoryError. Yes, simple to state, but coming up

Grails application taking more memory than possible?

I’m currently running a Grails application in Jetty. It’s working fine, but taking more memory than I’d like. htop shows that Jetty is being run like so: java -server -Xmx256m -Xms256m -Xmn96m -XX:Max


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

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

The HotSpot JVM allows you to hook up an agentlib from a profiler (see 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.

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.

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).