I'm having troubles to attach my java app to a remote java vm. I'm using java 8u45 on windows 7 and my attaching code is very simple
import java.io.IOException;
import java.util.List;
import java.util.Scanner;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
import com.sun.tools.attach.spi.AttachProvider;
public class AgentLoader
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
String pid = s.next();
try
{
VirtualMachine vm = VirtualMachine.attach(pid);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
when attach being called, I get AttachNotSupportedException and that there's no provider installed. I looked through some answers on the web and I saw few solutions that didn't work for me. like making sure that I don't mix up few versions of java on the same machine. set PATH variable to point to the attach.dll library located in %JAVA_HOME%\jre\bin etc..
none of them worked for me
any idea what could be the issue? Thanks