gpt4 book ai didi

java.lang.NoClassDefFoundError : org/apache/commons/vfs/FileSystemException

转载 作者:行者123 更新时间:2023-11-30 04:26:52 24 4
gpt4 key购买 nike

在我按照这里的示例代码进行操作后,发生了一件奇怪的事情

代码

try {
String filePath="C:\\srcFolder\\" + fileName;
String destFolder="\\destFolder";
int status = SFTP.sendFile(filePath, destFolder, ftpServer, ftpUserName, ftpPassword);
if(FileTransferStatus.SUCCESS == status){
System.out.println(filePath + " got sftp-ed successfully to folder "+destFolder);
}
else if(FileTransferStatus.FAILURE == status){
System.out.println("Fail to ssftp to folder "+destFolder);
}
} catch (FileTransferException e) {
e.printStackTrace();
}

堆栈跟踪

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/vfs/FileSystemException
at com.zehon.sftp.SFTP.getSFTPClient(SFTP.java:20)
at com.zehon.sftp.SFTP.sendFile(SFTP.java:50)
at uploadFile(ftpService.java:208)

编辑:我将 jar 包含在 Eclipse 项目外部库中,但仍然遇到相同的错误另外,我正在使用 Maven

最佳答案

将 commons-vfs-1.0.jar 放入特定项目的类路径中,并确保所有导入都位于 Java 类中

关于java.lang.NoClassDefFoundError : org/apache/commons/vfs/FileSystemException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15667041/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com