I have a custom class, whose package is given as java.util. The code was compiling fine before java version 9, but when I have changed java version to 11, I am facing package exists in another module: java.base. I need the class to get compiled with the same package java.util, so that it gets bootstraped as part of rt.jar. Can someone please help to rectify this issue. Thanks in advance.
I have tried adding --patch-module java.base=java.util in .mvn/jvm.config, but that didn't fix the issue.
The error you're encountering suggests that you have a class in your codebase with a package name that conflicts with a package in the
java.basemodule, which is part of the Java Standard Library. Specifically,java.utilis a well-known package injava.basethat contains various utility classes. Here's the thing I can suggest:After making the necessary changes, recompile your code and test it again.