Details
-
Sub-task
-
Status: Closed
-
P4
-
Resolution: Delivered
-
14
-
Verified
Description
In JDK 14, CDS runtime classpath validation is now more forgiving when dealing with files in the classpath that do not exist.
At CDS archive dump time, all non-existent elements in the classpath are automatically stripped. For example, if the command is:
java -cp nosuchfile.jar:hello.jar -Xshare:dump \
-XX:SharedClassListFile=hello.classlist \
-XX:SharedArchiveFile=hello.jsa
after removing the non-existing elements, the classpath recorded in `hello.jsa` becomes `hello.jar`.
Also, at run time, when the CDS archive is loaded, all non-existent elements in the classpath are ignored. With the previous example, all of the following commands will successfully load the archive:
(1)
```
java -cp nosuchfile.jar:hello.jar -Xshare:on \
-XX:SharedArchiveFile=hello.jsa \
Hello
```
(2)
```
java -cp hello.jar -Xshare:on \
-XX:SharedArchiveFile=hello.jsa \
Hello
```
(3)
```
java -cp alsonosuchfile.jar:hello.jar -Xshare:on \
-XX:SharedArchiveFile=hello.jsa \
Hello
```
In JDK 13 and earlier, only (1) is allowed while (2) and (3) would trigger an error.
At CDS archive dump time, all non-existent elements in the classpath are automatically stripped. For example, if the command is:
java -cp nosuchfile.jar:hello.jar -Xshare:dump \
-XX:SharedClassListFile=hello.classlist \
-XX:SharedArchiveFile=hello.jsa
after removing the non-existing elements, the classpath recorded in `hello.jsa` becomes `hello.jar`.
Also, at run time, when the CDS archive is loaded, all non-existent elements in the classpath are ignored. With the previous example, all of the following commands will successfully load the archive:
(1)
```
java -cp nosuchfile.jar:hello.jar -Xshare:on \
-XX:SharedArchiveFile=hello.jsa \
Hello
```
(2)
```
java -cp hello.jar -Xshare:on \
-XX:SharedArchiveFile=hello.jsa \
Hello
```
(3)
```
java -cp alsonosuchfile.jar:hello.jar -Xshare:on \
-XX:SharedArchiveFile=hello.jsa \
Hello
```
In JDK 13 and earlier, only (1) is allowed while (2) and (3) would trigger an error.