code: public static String findPathJar(final Class clas) throws IllegalStateException {
  		URL url;
  		String extURL;
  		try {
  			url = clas.getProtectionDomain().getCodeSource().getLocation();
  		} catch (final SecurityException ex) {
  			url = clas.getResource(clas.getSimpleName() + ".class");
  		}
  		extURL = url.toExternalForm();
  		try {
  			url = new URL(extURL);
  		} catch (final MalformedURLException mux) {
  			// leave url unchanged; probably does not happen
  		}
  		try {
  			return new File(url.toURI()).toString();
  		} catch (final Exception ex) {
  			return new File(url.getPath()).toString();
  		}
  
  	}
docs: If the provided class has been loaded from a jar file that is on the local
  file system, will find the absolute path to that jar file.
  
  @param clas the clas
  @return the string
  @throws IllegalStateException If the specified class was loaded from a
  directory or in some other way (such as via
  HTTP, from a database, or some other custom
  classloading device).