简体   繁体   中英

Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory - Command line

I am trying to run a jar which will download file from FTP server to my local machine, and as per the user manual there is ftpcourier.jar containing the class file to perform the task. as per user manual I prepared a command but I am getting NoClassDefFoundError on console.

C:\Program Files\Java\jdk1.7.0_79\jre\bin>java  -Demail-conf-path=d:\config -jar ftpcourier.jar -d RCVE -h test.hostname.com -u smandal -w Password# -f /TIFR/report.xls -t d:\Local -s true -p 22 -x true

getting error on console

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
    at com.dmainc.commons.stuff.ftp.FTPCourier.<clinit>(FTPCourier
Caused by: java.lang.ClassNotFoundException: org.apache.commons.loggin
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:30
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 1 more

I have added commons-logging-1.1.1.jar full path in environment variable. Any suggestions pls.

you should not add it in environment variable, instead of that you can add that path in the command line itself. give the directory path in the command like this. * means it will take all the jars in the given path

C:\Program Files\Java\jdk1.7.0_79\jre\bin>java -cp .;<path>\*;  -Demail-conf-path=d:\config -jar ftpcourier.jar -d RCVE -h test.hostname.com -u smandal -w Password# -f /TIFR/report.xls -t d:\Local -s true -p 22 -x true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM