-
Read Process Memory
Is there a way to read the memory of a process running on the system in java? In c++ there is a readProcessMemory() from the Windows API already built in.
I am new to this. Is there a way to implement the Windows API in java or does java have something similar built in? Anything along the lines of the Robot class or something?
any advice is welcome. thanks!
I am using eclipse 3.3.
-
I don't think java by itself can look in memory. Maybe with JNI
Why would you need to do that?
Java is supposed to be independent of OS, so would not have the Windows(as in MS) API. It has its own GUI API.
Java has a Robot class.
-
I had this issue just a couple weeks ago, and I ended up writing a small VB script that returns the memory of a process i specify to it. I have never written in VBscript before, so the code i got was hacked pieces of what I found on the internet. I actually ended up just writing the mem value to a .txt file and had my java program just read that .txt file. This might be a way for you to look into.
I'm not a Robot expert, but I don't think the Robot is going to help you very much here. It does have a waitForIdle method, but I'm not sure if that will help you. The robot is more applicable to simulating keyboard strokes, mouse movements, and delays.