Ubuntu packages seem to install java libraries in /usr/share/java directory but when trying to add this path to the command line. Java tries to validate every file in there and seems to fail. Ex:
$ java --module-path /usr/share/java --list-modules
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /usr/share/java/groovy.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class groovy not in module
(note that it also fails on other files, jansi-native.jar being one)
The only other issue I could find discussing something similar to this problem is Tomcat6 libs and /usr/share/java on Ubuntu but hopefully there is a better solution now than "wipe everything and start from scratch"?
Just in case:
$ java --version
openjdk 11.0.3 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu1, mixed mode)
Is there a way to ignore failed validations or am I missing how I should use those modules properly?
edit: Just to clarify, the issue isn't specifically about groovy, it's about the java module path validation. If it doesn't fail on groovy it will fail on something else:
$ java --module-path /usr/share/java --list-modules
Error occurred during initialization of boot layer
java.lang.module.FindException: Two versions of module xom found in /usr/share/java (xom.jar and xom-1.2.10.jar)
/usr/share/java$ ls *xom* -la
-rw-r--r-- 1 root root 182373 Jul 26 2013 xom-1.2.10.jar
lrwxrwxrwx 1 root root 14 Jul 26 2013 xom.jar -> xom-1.2.10.jar
I tried to remove all the packages that were causing issues(either through error in the jar or symlinked modules) until this one:
$ java --module-path /usr/share/java --list-modules
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /usr/share/java/jansi-native-1.8.jar
Caused by: java.lang.IllegalArgumentException: jansi.native: Invalid module name: 'native' is not a Java identifier
Sadly I can't remove this package as it is a dependency for maven.