List of utility methods to do Class Path
String | getPath(String name, Class> relativeTo) get Path return getFile(name, relativeTo).getAbsolutePath();
|
String | getProgramRootPath(Class clazz) get Program Root Path try { return java.net.URLDecoder .decode(getClassPathFile(clazz).getParentFile().getParentFile().getAbsolutePath(), "UTF-8"); } catch (Exception e) { e.printStackTrace(); return ""; |
String | getRootAbsolutePathname(final Class> clazz) get Root Absolute Pathname return getClassAbsolutePathname(clazz).replace(getClassRelativePathname(clazz), ""); |
String | getRunClassAllPath(Object obj) get Run Class All Path Object currClass = obj; String name = currClass.getClass().getSimpleName(); name += ".class"; URL clazzUrl = currClass.getClass().getResource(name); String clazzStr = clazzUrl.getPath(); try { clazzStr = java.net.URLDecoder.decode(clazzStr, "UTF-8"); } catch (UnsupportedEncodingException e) { ... |
String | getSystemLibraryPath(Class locatorClass, String subDir) get System Library Path String name = locatorClass.getCanonicalName(); name = "/" + name.replace('.', '/') + ".class"; URL classUrl = locatorClass.getResource(name); if (classUrl != null && classUrl.getProtocol().equals("file")) { String initializerPath = classUrl.getFile(); initializerPath = getSystemLibraryPath(initializerPath, name, subDir); try { initializerPath = URLDecoder.decode(initializerPath, System.getProperty("file.encoding")); ... |