JAVA命令执行java -cp后出现的问题,为什么不能执行成功?
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
F:\ >java -cp MinaTest.jar com.sony.client.test.DzjTemp
Exception in thread "main"
java.lang.NoClassDefFoundError: org/apache/commons/io
/IOUtils
at com.sony.client.test.dzjTemp.main(dzjTemp.java:39)
Caused by:
java.lang.ClassNotFoundException: org.apache.commons.io.IOUtils
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 1 more
F:\ >java -classpath MinaTest.jar com.sony.test.DeviceService
Exception in thread "main" java.lang.
NoClassDefFoundError: org/apache/mina/core/
filterchain/IoFilter
Caused by: java.lang.
ClassNotFoundException: org.apache.mina.core.filterchain.Io
Filter
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: com.sany.test.DeviceService. Program will exit.
------解决方案--------------------缺少运行时jar包
------解决方案--------------------java -cp
mina.jar;MinaTest.jar com.sony.client.test.DzjTemp
所有jar包都要列上来,windows上用分号隔开,linux用冒号隔开