private String getClassLocation() {
        final Class  cls           = getClass();
        URL          result        = null;
        final String clsAsResource = cls.getName().replace('.','/').concat(".class");

        final ProtectionDomain pd = cls.getProtectionDomain();
        // java.lang.Class contract does not specify if 'pd' can ever be null;
        // it is not the case for Sun's implementations, but guard against null
        // just in case:
        if (pd != null) {
            final CodeSource cs = pd.getCodeSource();
            // 'cs' can be null depending on the classloader behavior:
            if (cs != null)
                result = cs.getLocation();
        }

        if (result == null) {
            // Try to find 'cls' definition as a resource; this is not
            // documented to be legal, but Sun's implementations seem to allow this:
            final ClassLoader clsLoader = cls.getClassLoader();
            result = clsLoader != null ? clsLoader.getResource (clsAsResource) : ClassLoader.getSystemResource(clsAsResource);
        }

        String  value = "";

        if (result != null) {
            value   = path.replace( '.', '/' ) + '/';
            value   = result.toString() + value;
            value   = replace( value, "%20", " " );
            value   = replace( value, "file:/", "" );
        }

        return value;
    }