/** * Returns the path of the installation of the directory server. Note that this method assumes * that this code is being run locally. * * @return the path of the installation of the directory server. */ static String getInstallPathFromClasspath() { String installPath = DirectoryServer.getServerRoot(); if (installPath != null) { return installPath; } /* Get the install path from the Class Path */ final String sep = System.getProperty("path.separator"); final String[] classPaths = System.getProperty("java.class.path").split(sep); String path = getInstallPath(classPaths); if (path != null) { final File f = new File(path).getAbsoluteFile(); final File librariesDir = f.getParentFile(); /* * Do a best effort to avoid having a relative representation (for * instance to avoid having ../../../). */ try { installPath = librariesDir.getParentFile().getCanonicalPath(); } catch (IOException ioe) { // Best effort installPath = librariesDir.getParent(); } } return installPath; }