I am trying to attach a Java agent to a running Java instance using the attach API. The problem I am getting is when I check a process id of an already running Java process in Windows Task Manager and hard code it into the program attaching the java agent. Nothing happens. Is it so that we cannot attach a Java agent to an already running process.
I went through the dynamic agent loading tutorial it works fine but the only problem I see is, it detects the VM instance and dynamically attaches the Java agent to it. This instance none other than the one in which the current program for doing so is being launched.
Here requirement is to attach a Java agent to a already running VM instance like JMonitor and other analysis tools does. How to proceed kindly provide some direction.