Jan 02

Ubuntu Ant FTP task NoClassDefFoundError

Posted by James Netherton | Saturday 02 January 2010 13:10 PM | In Java

I came across a problem when trying to use the Ant FTP task on Ubuntu. Whenever I tried executing my build file I kept getting:

java.lang.ClassNotFoundException: org.apache.commons.net.ftp.FTPClientConfig

The simple fix is to make sure Ant can find the Apache commons-net Jar, either from under the Ant lib directory or in a custom location.

I installed Ant using Aptitude which places all of the shared Ant jars in /usr/share/ant/lib. I was confused because there was a symbolic link to ant-commons-net.jar which I thought should contain the missing classes. Turns out this Jar is actually the Ant FTP task library, you still need to download the commons-net Jar file.

1 Comment

[Post comment]


1

Posted by POC | Wednesday 20 January 1:00 AM

Nice post. lost an hour on this tonight. one would think that ‘apt-get install ant-optional’ would handle this. i’m wondering did java 6 change something.


Leave a comment