< prev index next >
src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java
Print this page
@@ -67,20 +67,21 @@
String s = VM.getSavedProperty("jdk.boot.class.path.append");
if (s != null && s.length() > 0)
bcp = toURLClassPath(s);
// we have a class path if -cp is specified or -m is not specified.
- // If neither is specified then default to -cp <working directory>.
+ // If neither is specified then default to -cp <working directory>
+ // If -cp is not specified and -m is specified, the value of
+ // java.class.path is an empty string if defined, then no class path.
URLClassPath ucp = null;
String mainMid = System.getProperty("jdk.module.main");
String cp = System.getProperty("java.class.path");
- if (mainMid == null && cp == null)
+ if (cp == null)
cp = "";
- if (cp != null)
+ if (mainMid == null || cp.length() > 0)
ucp = toURLClassPath(cp);
-
// create the class loaders
BOOT_LOADER = new BootClassLoader(bcp);
PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);
APP_LOADER = new AppClassLoader(PLATFORM_LOADER, ucp);
}
< prev index next >