I'm trying to figure out how does the VirtualMachine.loadAgentPath works in a native way, Because of some difficulties I can't use the java code to perform my agent loading and have to make it with native code.
I looked into the implementations of HotSpotVirtualMachine and saw that it is calling some execute method to perform the loading
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options)
throws AgentLoadException, AgentInitializationException, IOException {
InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options);
try {
int result = readInt(in);
if (result != 0) {
throw new AgentInitializationException("Agent_OnAttach failed", result);
}
} finally {
in.close();
}
}
But I can't figure out how I can call that execute or load method Has anyone tried that before?
Thanks