I have the following directory structure:
somedir/
lib/
myapp.jar
commons-io-2.1.jar
...lots of otherjars
From inside somedir
, I try to run the following command:
java -cp lib/* net.myapp.Driver /home/myUser.blah.text
And I am getting the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: lib/commons-io-2/1/jar
Caused by: java.lang.ClassNotFoundException: lib.commons-io-2.1.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: lib/commons-io-2.1.jar. Program will exit.
Why is it telling me that it can't find a "main" in Apache Commons IO? I might be able to understand if it couldn't find my Driver
class (maybe I misconfigured something), but this is just throwing me way off. Ideas? Thanks in advance!
you could also try java -cp /lib/* net.myapp.Driver /home/myUser.blah.text