Xbootclasspath/a adds CWD to boot class path

Michael Rasmussen michael.rasmussen at zeroturnaround.com
Tue Sep 26 11:49:47 UTC 2017

On 26 September 2017 at 14:18, David Holmes <david.holmes at oracle.com> wrote:

> Hi Michael,
> On 26/09/2017 9:01 PM, David Holmes wrote:
>> Hi Michael,
>> Moving over to core-libs-dev.
>> The discussion in 8185540 is a bit confusing to me.
> I've re-read the discussion and related bugs. As I understand it what you
> see now is expected and reflects what happens in 7 and 8. What should see
> is that the empty path elements causes CWD to be included for resource
> lookup, but not for class lookup. That inconsistency was flagged for fixing
> in 7, deferred to 9, rectified early on, but then reverted when the module
> system was integrated - with the eventual fix re-appearing in JDK 10.

No, running similar code on Java 8 (using new ClassLoader(null){} instead
of platform classloader), yields only the resource found in /tmp, not the
one in CWD:
$ java -version
java version "1.8.0_144"
$ java -Xbootclasspath/a:/tmp Test

The issue I wrote about is that that adding *any* -Xbootclasspath/a on Java
9 will also add an empty path element (thus add CWD).
The case I linked was somewhat related, in that it inadvertently fixes this
issue (by removing all empty path elements, regardless of origin).


More information about the core-libs-dev mailing list