I have one .java file (driver.java) that I am trying to compile and run from the command line. It uses an external library called EXT.jar , the structure of which is just a folder named EXT with dozens of classes inside it.
So, I run:
javac -cp EXT.jar driver.java
This compiles the class just fine.
then at startup:
java -cp EXT.jar driver
I get java.lang.NoClassDefFoundError .
Oddly enough, if I unzip the JAR (now I have a folder in the EXT root directory), the last command works just fine! The driver will be executed!
Is there any way to get driver.class to look for needs class files from EXT.jar/EXT/*class instead of the actual EXT folder?
Thanks!
java command-line jar compilation
Monster
source share