Java Class Path getRunClassAllPath(Object obj)

Here you can find the source of getRunClassAllPath(Object obj)

Description

get Run Class All Path

License

Apache License

Declaration

public static String getRunClassAllPath(Object obj) 

Method Source Code


//package com.java2s;
import java.io.UnsupportedEncodingException;
import java.net.URL;

public class Main {

    public static String getRunClassAllPath(Object obj) {

        Object currClass = obj;//  w ww  .  j a v  a  2s .c om
        String name = currClass.getClass().getSimpleName();
        name += ".class";
        URL clazzUrl = currClass.getClass().getResource(name);
        String clazzStr = clazzUrl.getPath();
        try {
            clazzStr = java.net.URLDecoder.decode(clazzStr, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return clazzStr;
    }
}

Related

  1. getPath(Class tClass)
  2. getPath(final String aPath, final Class aClass)
  3. getPath(String name, Class relativeTo)
  4. getProgramRootPath(Class clazz)
  5. getRootAbsolutePathname(final Class clazz)
  6. getSystemLibraryPath(Class locatorClass, String subDir)