/** * @return the jar file that contains MyClass as File. */ private static File getCurrentJarFile() throws Exception{ String path =MyClass .class.getProtectionDomain().getCodeSource().getLocation().getPath(); String decodedPath = URLDecoder.decode(path, "UTF-8"); return new File(decodedPath).getAbsoluteFile(); }