public static String getJarDir(Class<?> clazz) {
        return decodeUrl(new File(clazz.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent());
    }
public static String getJarDir ( Class < ? > clazz ) { return decodeUrl ( new File ( clazz . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) . getPath ( ) ) . getParent ( ) ) ; }
Get Jar location

@param clazz
Based on class location
@return String