Question: Restriction on non-empty directory on cass path

Ioi Lam ioi.lam at
Wed Dec 13 05:28:04 UTC 2017

This was a design decision. CDS require any directories on the classpath 
to be empty (I think we really should discourage directories to be use 
in the classpath). The reason is that it's difficult to check whether 
the any class files have been added/modified/removed -- if we don't do 
such checks, then the program will load different classes depending on 
whether CDS is enabled.

What's the reason for your users to append directories to the classpath?


- Ioi

On 12/12/17 9:18 PM, yumin qi wrote:
> Hi,
>   The question is for CDS. When dump CDS using (tried with Ioi's 
> AppCDS patch)
>   -Xshare:dump -XX:+UseAppCDS  -cp somedir:somedir/somefile.jar
>    if somedir does not contain any classes file, but other non class 
> files, it will fail here:
> ClassLoaderExt::add_class_path_entry(...):
>          tty->print_cr("Error: non-empty directory '%s'", path);
>          exit_with_path_failure("Cannot have non-empty directory in 
> boot/ext/app classpaths", NULL);
>    Why not just skip adding such class path entry? Will it fail on 
> share if those entries skipped?
>    Is this a design behavior?
>    User some time append such directories to class path, and will 
> confuse on such failure on CDS since it won't fail on non-CDS way.
>     Any inputs really appreciated.
>   Thanks
>   Yumin

More information about the hotspot-dev mailing list