// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.IOException;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

public class Available {
    private static String getLocation(Class<?> clz) {
        return clz.getProtectionDomain().getCodeSource().getLocation().getPath();
    }
    public static void main(String[] args) throws IOException {
        String jarnam = getLocation(Available.class);
        System.out.println(jarnam);
        JarFile jarf = new JarFile(jarnam);
        Enumeration<JarEntry> e = jarf.entries();
        while(e.hasMoreElements()) {
            JarEntry je = e.nextElement();
            String clznam = je.getName().replace('/', '.');
            if(clznam.endsWith(".class")) {
                System.out.println(clznam);
            }
        }
        jarf.close();
    }
}

class A {
}

class B {
}

class C {
}
