JarUtils { public static boolean isProjectJar(final Class<?> clazz) { if (clazz == null) return false; try { return !new File(clazz.getProtectionDomain().getCodeSource().getLocation().toURI()) .getName().endsWith(SUFFIX_JAR); } catch (Exception e) { LOGGER.error(ExceptionUtils.errorInfo(e)); return true; } } private  JarUtils(); static JarUtils getInstance(); static void loadPropsWithinJar(String jarPath); static void loadPropsWithinJar(URL sourceUrl); static boolean isProjectJar(final Class<?> clazz); String getProperty(String key);  }
@Test public void locationTest() { assertTrue(JarUtils.isProjectJar(JarUtilsTest.class)); }