< prev index next >

src/java.base/share/classes/sun/misc/Launcher.java

Print this page




 302                     (java.security.cert.Certificate[]) null),
 303                 perms);
 304 
 305             AccessControlContext acc =
 306                 new AccessControlContext(new ProtectionDomain[] { domain });
 307 
 308             return acc;
 309         }
 310     }
 311 
 312     private static class BootClassPathHolder {
 313         static final URLClassPath bcp;
 314         static {
 315             URL[] urls = AccessController.doPrivileged(
 316                     new PrivilegedAction<URL[]>() {
 317                         public URL[] run() {
 318                             String bootClassPath = System.getProperty("sun.boot.class.path");
 319                             if (bootClassPath == null)
 320                                 return new URL[0];
 321                             // Skip empty path in boot class path i.e. not default to use CWD
 322                             File[] classPath = getClassPath(bootClassPath, false);
 323                             int len = classPath.length;
 324                             Set<File> seenDirs = new HashSet<File>();
 325                             for (int i = 0; i < len; i++) {
 326                                 File curEntry = classPath[i];
 327                                 // Negative test used to properly handle
 328                                 // nonexistent jars on boot class path
 329                                 if (!curEntry.isDirectory()) {
 330                                     curEntry = curEntry.getParentFile();
 331                                 }
 332                                 if (curEntry != null && seenDirs.add(curEntry)) {
 333                                     MetaIndex.registerDirectory(curEntry);
 334                                 }
 335                             }
 336                             return pathToURLs(classPath);
 337                         }
 338                     }
 339                 );
 340             bcp = new URLClassPath(urls, factory);
 341         }
 342     }
 343 
 344     public static URLClassPath getBootstrapClassPath() {
 345         return BootClassPathHolder.bcp;
 346     }
 347 
 348     private static URL[] pathToURLs(File[] path) {
 349         URL[] urls = new URL[path.length];
 350         for (int i = 0; i < path.length; i++) {
 351             urls[i] = getFileURL(path[i]);
 352         }
 353         // DEBUG
 354         //for (int i = 0; i < urls.length; i++) {
 355         //  System.out.println("urls[" + i + "] = " + '"' + urls[i] + '"');
 356         //}




 302                     (java.security.cert.Certificate[]) null),
 303                 perms);
 304 
 305             AccessControlContext acc =
 306                 new AccessControlContext(new ProtectionDomain[] { domain });
 307 
 308             return acc;
 309         }
 310     }
 311 
 312     private static class BootClassPathHolder {
 313         static final URLClassPath bcp;
 314         static {
 315             URL[] urls = AccessController.doPrivileged(
 316                     new PrivilegedAction<URL[]>() {
 317                         public URL[] run() {
 318                             String bootClassPath = System.getProperty("sun.boot.class.path");
 319                             if (bootClassPath == null)
 320                                 return new URL[0];
 321                             // Skip empty path in boot class path i.e. not default to use CWD
 322                             return pathToURLs(getClassPath(bootClassPath, false));














 323                         }
 324                     }
 325                 );
 326             bcp = new URLClassPath(urls, factory);
 327         }
 328     }
 329 
 330     public static URLClassPath getBootstrapClassPath() {
 331         return BootClassPathHolder.bcp;
 332     }
 333 
 334     private static URL[] pathToURLs(File[] path) {
 335         URL[] urls = new URL[path.length];
 336         for (int i = 0; i < path.length; i++) {
 337             urls[i] = getFileURL(path[i]);
 338         }
 339         // DEBUG
 340         //for (int i = 0; i < urls.length; i++) {
 341         //  System.out.println("urls[" + i + "] = " + '"' + urls[i] + '"');
 342         //}


< prev index next >