I have an application which runs in a sandbox environment using an OpenJDK. The JDK directory has a jmods folder.
The documentation regarding jmods isn't that great. From what I understand, jmods is useful if I want to create another custom JRE using JLink.
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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With