public static URLClassPath getBootstrapClassPath() {
String prop = AccessController.doPrivileged(
new GetPropertyAction("sun.boot.class.path"));
URL[] urls;
if (prop != null) {
final String path = prop;
urls = (URL[])AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
File[] classPath = getClassPath(path);
int len = classPath.length;
Set seenDirs = new HashSet();
for (int i = 0; i < len; i++) {
File curEntry = classPath[i];
// Negative test used to properly handle
// nonexistent jars on boot class path
if (!curEntry.isDirectory()) {
curEntry = curEntry.getParentFile();
}
if (curEntry != null && seenDirs.add(curEntry)) {
MetaIndex.registerDirectory(curEntry);
}
}
return pathToURLs(classPath);
}
}
);
} else {
urls = new URL[0];
}
return new URLClassPath(urls, factory);
}
|