Does the jmods directory in jdk/jmods have any role during application runtime?
No. These are only archives that are used as input to jlink
. The class files and other resources that are used during runtime are stored in the lib/modules
archive, which is in a custom format that can be read for instance with the jimage
tool. (or by JDK code using one of two jimage library implementations in the JDK)
.jmod
files are not meant to be used during execution. If you try to put a .jmod
file on the module path, you even get an error:
java.lang.module.FindException: JMOD format not supported at execution time: <some.mod>.jmod
Say, if I don't want to do that and just want to have a JDK which can build and run my Java SWT application. Will it be safe to simply remove the jmods directory?
If you use jlink
to create a runtime image, it will not contain a jmods directory in the first place. So, there's nothing you should have to remove.