How to obtain the consumption memory of running “exe”-Collection of common programming errors
GetProcessMemoryInfo will tell you how much memory a process is using once you have a handle open to it. Microsoft even has an example for using the function.
To get the process ID you’re looking for, you will need to enumerate through all the processes in the system. Microsoft has an example that would be useful for that too.
Edit: The examples are all in C. This is the language the Win32 API was designed for. From Java, you’ll either need to translate it to the JNI or find a Java package that does the same things.