8191170: Clarify if java.class.path can be undefined
authormchung
Thu, 25 Jan 2018 13:40:36 -0800
changeset 48671 a47ee8b3d308
parent 48670 ea6706103cef
child 48672 77baeab90732
8191170: Clarify if java.class.path can be undefined Reviewed-by: alanb, psandoz
src/java.base/share/classes/java/lang/ClassLoader.java
src/java.base/share/classes/java/lang/System.java
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Jan 25 13:39:28 2018 -0800
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Jan 25 13:40:36 2018 -0800
@@ -1876,14 +1876,15 @@
      * value until the system is fully initialized.
      *
      * <p> The name of the built-in system class loader is {@code "app"}.
-     * The class path used by the built-in system class loader is determined
-     * by the system property "{@code java.class.path}" during early
-     * initialization of the VM. If the system property is not defined,
-     * or its value is an empty string, then there is no class path
-     * when the initial module is a module on the application module path,
-     * i.e. <em>a named module</em>. If the initial module is not on
-     * the application module path then the class path defaults to
-     * the current working directory.
+     * The system property "{@code java.class.path}" is read during early
+     * initialization of the VM to determine the class path.
+     * An empty value of "{@code java.class.path}" property is interpreted
+     * differently depending on whether the initial module (the module
+     * containing the main class) is named or unnamed:
+     * If named, the built-in system class loader will have no class path and
+     * will search for classes and resources using the application module path;
+     * otherwise, if unnamed, it will set the class path to the current
+     * working directory.
      *
      * @return  The system {@code ClassLoader}
      *
--- a/src/java.base/share/classes/java/lang/System.java	Thu Jan 25 13:39:28 2018 -0800
+++ b/src/java.base/share/classes/java/lang/System.java	Thu Jan 25 13:40:36 2018 -0800
@@ -631,7 +631,8 @@
      * <tr><th scope="row"><code>java.class.version</code></th>
      *     <td>Java class format version number</td></tr>
      * <tr><th scope="row"><code>java.class.path</code></th>
-     *     <td>Java class path</td></tr>
+     *     <td>Java class path  (refer to
+     *        {@link ClassLoader#getSystemClassLoader()} for details)</td></tr>
      * <tr><th scope="row"><code>java.library.path</code></th>
      *     <td>List of paths to search when loading libraries</td></tr>
      * <tr><th scope="row"><code>java.io.tmpdir</code></th>