2014-03-31 368 views
0

我正在尝试使用FTPClient读取文件名。我使用了commons-net-3.3.jar和commons-io-2.4.jar。但在执行时,我得到以下例外,无法解析导入org.apache.oro

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
The import org.apache.oro cannot be resolved 
The import org.apache.oro cannot be resolved 
The import org.apache.oro cannot be resolved 
The import org.apache.oro cannot be resolved 
The import org.apache.oro cannot be resolved 
The import org.apache.oro cannot be resolved 
Pattern cannot be resolved to a type 
MatchResult cannot be resolved to a type 
PatternMatcher cannot be resolved to a type 
_matcher_ cannot be resolved 
Perl5Matcher cannot be resolved to a type 
pattern cannot be resolved 
Perl5Compiler cannot be resolved to a type 
MalformedPatternException cannot be resolved to a type 
result cannot be resolved or is not a field 
_matcher_ cannot be resolved 
pattern cannot be resolved or is not a field 
result cannot be resolved or is not a field 
_matcher_ cannot be resolved 
result cannot be resolved or is not a field 
result cannot be resolved or is not a field 
result cannot be resolved or is not a field 
result cannot be resolved or is not a field 
result cannot be resolved or is not a field 
result cannot be resolved or is not a field 
result cannot be resolved or is not a field 



at org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl.<init>(RegexFTPFileEntryParserImpl.java:19) 
at org.apache.commons.net.ftp.parser.ConfigurableFTPFileEntryParserImpl.<init>(ConfigurableFTPFileEntryParserImpl.java:57) 
at org.apache.commons.net.ftp.parser.UnixFTPEntryParser.<init>(UnixFTPEntryParser.java:136) 
at org.apache.commons.net.ftp.parser.UnixFTPEntryParser.<init>(UnixFTPEntryParser.java:119) 
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createUnixFTPEntryParser(DefaultFTPFileEntryParserFactory.java:169) 
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:94) 
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2359) 
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2142) 
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2188) 
at com.school.util.GetFileList.main(GetFileList.java:32) 
+1

你如何将jar作为外部库包含在项目中? – Jason

+0

你从哪里得到这些JAR文件?我无法相信你会从Apache获得他们的编译问题。 – Thilo

回答

2

看起来你有一个旧版本的commons-net,它取决于你的classpath中的Jakarta ORO。 Commons-net过去依赖于ORO,直到版本1.4.1
如果您使用的是Maven/Gradle/Ivy,请确保您没有将此版本作为传递依赖项或其他库。
舍弃这个旧版本的commons-net应该可以解决问题。

+0

我正在使用ANT构建... – Souvikcs48

+0

因此,请确保Ant正在使用commons-net的正确版本。如果.jar名称不包含版本,则可以检查其META-INF/MANIFEST.MF文件 –

+0

中指定的文件,感谢它使用了正确版本的commons-net。 – Souvikcs48

相关问题