用Eclipse3.3+Ant1.7.0,在build.xml文件中使用ftp将包发到远程服务器上时总是出错,出错信息为:
“Could not create type ftp due to java.lang.NoClassDefFoundError:
org/apache/commons/net/ftp/FTPClientConfig”
结果Google了N久,知道是少了两个包:commons-net-1.4.1.jar和jakarta-oro-2.0.8.jar
把这两个包放到Eclipse的Ant的lib目录下,在Eclipse重新执行ant,问题依然存在。结果又Google了很久,最终,在一篇外国博文 中找到解决方法,原文如下
“I had the same error message, but only in Eclipse (version 3.3).
I did not get the error on command line. I had setup up ANT_HOME variable correctly and copied the jakarta-oro-2.0.8.jar and commons-net-1.4.1.jar to %ANT_HOME%\lib
However it seems that the ANT Eclipse module does not automatically parse the %ANT_HOME%\lib directory for new jars and I had to add them manually
preferences->Ant->Runtime, Classpath tab, Ant Home Entries -> Add External JARs...
Then it worked. ”
JDK 选择用1.6