src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java
changeset 53018 8bf9268df0e2
parent 52427 3c6aa484536c
child 53660 929f0c7e019b
equal deleted inserted replaced
53017:e10a1f7aaa13 53018:8bf9268df0e2
    57     // Creates the built-in class loaders.
    57     // Creates the built-in class loaders.
    58     static {
    58     static {
    59         // -Xbootclasspath/a or -javaagent with Boot-Class-Path attribute
    59         // -Xbootclasspath/a or -javaagent with Boot-Class-Path attribute
    60         String append = VM.getSavedProperty("jdk.boot.class.path.append");
    60         String append = VM.getSavedProperty("jdk.boot.class.path.append");
    61         BOOT_LOADER =
    61         BOOT_LOADER =
    62             new BootClassLoader((append != null && append.length() > 0)
    62             new BootClassLoader((append != null && !append.isEmpty())
    63                 ? new URLClassPath(append, true)
    63                 ? new URLClassPath(append, true)
    64                 : null);
    64                 : null);
    65         PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);
    65         PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);
    66 
    66 
    67         // A class path is required when no initial module is specified.
    67         // A class path is required when no initial module is specified.
    68         // In this case the class path defaults to "", meaning the current
    68         // In this case the class path defaults to "", meaning the current
    69         // working directory.  When an initial module is specified, on the
    69         // working directory.  When an initial module is specified, on the
    70         // contrary, we drop this historic interpretation of the empty
    70         // contrary, we drop this historic interpretation of the empty
    71         // string and instead treat it as unspecified.
    71         // string and instead treat it as unspecified.
    72         String cp = System.getProperty("java.class.path");
    72         String cp = System.getProperty("java.class.path");
    73         if (cp == null || cp.length() == 0) {
    73         if (cp == null || cp.isEmpty()) {
    74             String initialModuleName = System.getProperty("jdk.module.main");
    74             String initialModuleName = System.getProperty("jdk.module.main");
    75             cp = (initialModuleName == null) ? "" : null;
    75             cp = (initialModuleName == null) ? "" : null;
    76         }
    76         }
    77         URLClassPath ucp = new URLClassPath(cp, false);
    77         URLClassPath ucp = new URLClassPath(cp, false);
    78         APP_LOADER = new AppClassLoader(PLATFORM_LOADER, ucp);
    78         APP_LOADER = new AppClassLoader(PLATFORM_LOADER, ucp);