Skip to content

Commit c41a283

Browse files
committed
8273853: Update the Java manpage for automatic CDS archive updating
Reviewed-by: ccheung, dholmes
1 parent 41d5809 commit c41a283

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

src/java.base/share/man/java.1

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5374,9 +5374,9 @@ Therefore, you can omit the \f[CB]<static_archive>\f[R] by saying only:
53745374
.PP
53755375
\f[CB]\-XX:SharedArchiveFile=<dynamic_archive>\f[R]
53765376
.RE
5377-
.SS Creating CDS Archives
5377+
.SS Manually Creating CDS Archives
53785378
.PP
5379-
CDS archives can be created with several methods:
5379+
CDS archives can be created manually using several methods:
53805380
.IP \[bu] 2
53815381
\f[CB]\-Xshare:dump\f[R]
53825382
.IP \[bu] 2
@@ -5438,7 +5438,7 @@ The output of this command should contain the following text:
54385438
\f[CB][info][class,load]\ test.Hello\ source:\ shared\ objects\ file\f[R]
54395439
.RE
54405440
.RE
5441-
.SS Creating a Dynamic CDS Archive File with \-XX:SharedArchiveFile
5441+
.SS Creating a Dynamic CDS Archive File with \-XX:ArchiveClassesAtExit
54425442
.PP
54435443
Advantages of dynamic CDS archives are:
54445444
.IP \[bu] 2
@@ -5533,6 +5533,42 @@ application start\-up script with the same technique:
55335533
.PP
55345534
\f[CB]env\ JAVA_TOOL_OPTIONS=\-XX:+RecordDynamicDumpInfo\ bash\ app_start.sh\f[R]
55355535
.RE
5536+
.SS Creating Dynamic CDS Archive File with \-XX:+AutoCreateSharedArchive
5537+
.PP
5538+
\f[CB]\-XX:+AutoCreateSharedArchive\f[R] is a more convenient way of
5539+
creating/using CDS archives.
5540+
Unlike the methods of manual CDS archive creation described in the
5541+
previous section, with \f[CB]\-XX:+AutoCreateSharedArchive\f[R], it\[aq]s
5542+
no longer necessary to have a separate trial run.
5543+
Instead, you can always run the application with the same command\-line
5544+
and enjoy the benefits of CDS automatically.
5545+
.RS
5546+
.PP
5547+
\f[CB]java\ \-XX:+AutoCreateSharedArchive\ \-XX:SharedArchiveFile=hello.jsa\ \-cp\ hello.jar\ Hello\f[R]
5548+
.RE
5549+
.PP
5550+
If the specified archive file exists and was created by the same version
5551+
of the JDK, then it will be loaded as a dynamic archive; otherwise it is
5552+
ignored at VM startup.
5553+
.PP
5554+
At VM exit, if the specified archive file does not exist, it will be
5555+
created.
5556+
If it exists but was created with a different (but post JDK 19) version
5557+
of the JDK, then it will be replaced.
5558+
In both cases the archive will be ready to be loaded the next time the
5559+
JVM is launched with the same command line.
5560+
.PP
5561+
If the specified archive file exists but was created by a JDK version
5562+
prior to JDK 19, then it will be ignored: neither loaded at startup, nor
5563+
replaced at exit.
5564+
.PP
5565+
Developers should note that the contents of the CDS archive file are
5566+
specific to each build of the JDK.
5567+
Therefore, if you switch to a different JDK build,
5568+
\f[CB]\-XX:+AutoCreateSharedArchive\f[R] will automatically recreate the
5569+
archive to match the JDK.
5570+
If you intend to use this feature with an existing archive, you should
5571+
make sure that the archive is created by at least version 19 of the JDK.
55365572
.SS Restrictions on Class Path and Module Path
55375573
.IP \[bu] 2
55385574
Neither the class path (\f[CB]\-classpath\f[R] and

0 commit comments

Comments
 (0)