// 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.util.*;

public class GetPath {
    private static String getPath() {
        String cn = GetPath.class.getName();
        StringTokenizer st = new StringTokenizer(cn,".");
        StringBuffer sb = new StringBuffer("");
        boolean first = true;
        while(st.hasMoreTokens()) {
            if(first) {
                first = false;
            } else {
                sb.append("/");
            }
            sb.append(st.nextToken());
        }
        sb.append(".class");
        String path = GetPath.class.getClass().getClassLoader().getSystemResource(sb.toString()).getPath();
        return path;
    }
    public static void main(String[] args) {
      System.out.println(getPath());
    }
}
