I've got a small program (presently six *.java
files, plus the ini4j-0.5.4.jar
library). It works fine from Eclipse, but I need to compile and run it on a system with no graphics capability, so I've built a javac
command for it, to be run from the project directory:
javac -d bin -classpath libs/ini4j-0.5.4.jar src/main/*.java
When it runs, it produces two lines:
error: module not found: ini4j
1 error
I've been away from Java programming for some years, and I'm just catching up with the changes for modules and such. It seems that that's the source of the trouble: the ini4j
file was written before modules were a thing. I've seen hints that there's a way to make a modular Java program work with non-modular components, and obviously it works when I run it from the Eclipse GUI, but the way to coax the javac
compiler to accept it eludes me.
I'm using openjdk (and javac) 11.0.3 under Ubuntu 19.04, if that helps.
Bottom line: how can I get this non-modular JAR file to compile into a new (modular, simple) Java program with the javac
command-line compiler?
SOLUTION: With the help of the comments and answer, I found a way to fix the problem, by altering the javac
command line to this:
javac -g -d bin --module-path libs/ini4j-0.5.4.jar src/main/*.java
Now it doesn't give me any problems when compiling. :-) Still trying to figure out how to actually run it from the command line, but that's a different subject.
Thank you all for your help!