Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
rednaxelafx / DumpClassURL.java
Created December 7, 2011 09:48
Using the ProtectionDomain of an InstanceKlass to see where it was loaded from, with Attach API this time
import java.lang.instrument.Instrumentation;
import java.net.URL;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.Arrays;
import java.util.Comparator;
public class DumpClassURL {
public static void agentmain(String agentArgs, Instrumentation inst) {
Class<?>[] classes = inst.getAllLoadedClasses();