Skip to Content
0
Sep 15, 2023 at 09:11 PM

How to resolve java.lang.module.FindException with Java Connector?

235 Views

I'm getting a Java module-related error when trying to set up SAP Java Connector with a Java 17 application that defines Java modules. How can I resolve this? Does Java Connector make use of Java modules, e.g. has a module-info.java file in its package? Is there some guidance how to refer to it from within a Java module?

The error I'm getting is:

java.lang.module.FindException: Module sapjco3 not found, required by com.zz.zzzzz.zzz.zzz

I'm using Gradle and am pulling in the sapjco3 jar like this:

dependencies {

   implementation files('C:/java/sap/sapjco3.jar', 'C:/java/sap/sapjco3.dll')<br>...

}

This works fine on a test application that is not modularized. But in our real application, we have this in our module-info.java:

module com.zz.zzzzz.zzz.zzz{

requires ...;
requires java.net.http;
,,, requires sapjco3;
opens com.zz.zzzzz.zzz.zzz to ...;
exports com.zz.zzzzz.zzz.zzz;
}

This compiles and builds but when it runs, we get the java.lang.module.FindException detailed above. I've tried a variation of the requires line for sapjco3 (com.sap.sapjco3), but that wouldn't compile. What's the correct value to put in there so this can run?