Running a java program with multiple jar files and classes

I am compiling a program with multiple jar files (inside the lib folder) and classes (inside the src/com folder) with:

javac -classpath lib/* src/com/*.java

I typed this to run the program:

java -cp lib/* src/com/okc

But it doesn’t work. Instead, I get this:

Error: Could not find or load main class src.com.okc

okc.java is the class containing the main method. How can I run a java program with multiple jar files and classes?


Source: java

Leave a Reply