In JDK 11 (and all prior versions), the path matching check performed by AppCDS is overly restrictive, which invalidates a previously generated archive unnecessarily in certain cases.
Following is one use case that is currently prohibited by the overly restrictive path matching check:
1. Dump the shared archive with -Xshare:dump using a specific JDK 11 image
2. Copy the JDK image and generated archive to another device (with different path) or another location
3. Run with -Xshare:on or -Xshare:auto using the same JDK image and archive
The shared archive generated by step 1 can not be used by step 3. With -Xshare:on, the following error is reported:
An error has occurred while processing the shared archive file.
shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)
Error occurred during initialization of VM
Unable to use shared archive.
NOTE: The check is only done when -XX:+UseAppCDS is enabled, and not with the basic CDS.