public File getClassRootDir(Class classz){ String filePath = classz.getProtectionDomain().getCodeSource().getLocation().getFile(); return new File(filePath); } public File getJarFile(Class classz){ String filePath = classz.getProtectionDomain().getCodeSource().getLocation().getFile(); return new File(filePath); }