Monday, August 10, 2009

Running the ftp ant task in eclipse with version 2.0 of the Apache Commons-Net library

...doesn't work!

(In case you are not familiar with running ant in eclipse, read both parts of the very good O'reilly article on that topic: part1, part2).

Now, if you want to use the ftp ant task in eclipse (which is not a core ant task), you will need to install some more java classes. Read this article for the details. However, keep in mind that you need version 1.4.1 of the Apache Commons-Net library, and not 2.0, which at the time of writing is the latest version (I'm using eclipse 3.4.0). If you use version 2, however, and you get something like this from eclipse:

Could not create type ftp due to java.lang.UnsupportedClassVersionError: org/apache/commons/net/ftp/FTPClientConfig (Unsupported major.minor version 49.0)

it means you're stubborn :). So use version 1.4.1.

UPDATE
Courtesy of Gary, a Java informed friend, here's the real reason for the error:
"The error 'Unsupported major.minor version 49.0' means that java 5 is required. Its possible that you have configured somewhere to use java 1.4 (v4).
if you make sure you have java 5 installed and configure eclipse to use this version then you should be okay."

No comments: