Saving a copy of the Java Shared classes to disk

On z/OS the Java shared classes use shared virtual storage. Data is added to the shared classes as the application process classes, so successive Java applications can use this shared data.

You can harden this to disk, so it is available across an IPL, by using the Java shared classes snapshotCache command, and run a restoreSnapshortCache after the IPL (or as part of your application start up).

What happens when you snapshot a cache?

You use a command like

/usr/lpp/java/J17.0_64/bin/java -Xshareclasses:cacheDir=/u/tmp/zowec,name=zoweGW,snapshotCache

This creates a file in the “cacheDir” like

 828 -rwxrwxrwx   1 ZWESVUSR ZWEADMIN 10485760 C290M17F1A64S_zoweGW_G43L00              

Where the file is owned by userid that created the shared cache, and its group. User ZWESVUSR, and group:ZWEADMIN. The release of Java is in the file names… C290M17.

If you do not have authority to create such as file the snapshot request will fail.

You might want to consider putting a snapshot job step into your Java applications JCL, so you always save the latest copy.

One thought on “Saving a copy of the Java Shared classes to disk

Leave a comment