This is a sample application to reproduce AppCDS writes local paths into .jsa archive (and is slow when the jar files don't exist).
The project is a small Compose application that shows a single window and shuts down after 5 seconds. It also prints to stdout the time it took to start.
The project includes two sets of three scripts (one set for Windows and one set for macOS):
win/macos_prepare.sh:- Builds the app
- Runs the app with
-XX:ArchiveClassesAtExitto create the jsa archive - Creates a copy of the app in the project's root directory.
win/macos_run_normal.sh: Runs the app's copy without AppCDSwin/macos_run_appcds.sh: Runs the app's copy with AppCDS You may need to use cygwin, or some sort of unix shell to run the Windows scripts.
After you've run the prepare script, you can run the run_normal and run_appcds scripts and see that the AppCDS
version is significantly faster.
If you delete the original jar files whose paths were written into the jsa archive
(under composeApp/build/compose/binaries/main/app/):
- When running the app copy, you will get many lines like this printed:
[0.107s][warning][cds] Required classpath entry does not exist: C:\Users\msash\Projects\AppCdsDemo\composeApp\build\compose\binaries\main\app\AppCdsDemo\app\runtime-desktop-1.9.0-c25a54d26562099d86e41defd73c526.jar - Only on Windows the app will start up much slower, almost as slow as without AppCDS at all.