我有以下目录结构:
somedir/
lib/
myapp.jar
commons-io-2.1.jar
...lots of otherjars
从内部somedir
,我尝试运行以下命令:
java -cp lib/* net.myapp.Driver /home/myUser.blah.text
我得到以下异常:
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.
为什么它告诉我它在 Apache Commons IO 中找不到“main”?我可能能够理解它是否找不到我的Driver
课程(也许我配置错误),但这只是让我失望。想法?提前致谢!