class ResourceLoader {

    public static AbstractFile getRootPackageAsFile(Class<?> aClass) {
        ClassLoader classLoader = aClass.getClassLoader();
        if(classLoader==null)
            classLoader = getDefaultClassLoader();

        String aClassRelPath = getRelativeClassPath(aClass);
        URL aClassURL = getResourceAsURL(aClassRelPath, classLoader, null);

        if(aClassURL==null)
            return null;    // no resource under that path

        if("jar".equals(aClassURL.getProtocol()))
            return FileFactory.getFile(getJarFilePath(aClassURL));

        String aClassPath = getLocalFilePath(aClassURL);
        return FileFactory.getFile(aClassPath.substring(0, aClassPath.length()-aClassRelPath.length()));
    }

}