Reputation: 23
I'm using JDK 11 on Windows. I realized a modular JAR file, Uti.jar (into the directory dirLib), containing some classes in a single package, say pkg.
Then I realized a simple client, say app.Maine, not a module, with a main method (a console app), which uses a class contained in Uti.jar, say pkg.MyClass.
I'm able to execute the console app with the command:
java -classpath dirLib/Uti.jar;. app.Maine
It works.
But I've problems when trying to use a JMOD file instead of Uti.jar. I built Uti.jmod by using the command
jmod create --class-path pkg dirLib/Uti.jmod
It seems containing the same classes as Uti.jar, but the command
java -classpath dirLib/Uti.jmod;. app.Maine
gives an error, NoClassDefFoundError pkg/MyClass.
Where am I mistaking ?
Thanks in advance
Upvotes: 1
Views: 1007