springboot创建新module报错- 错误: 找不到或无法加载主类

选择Edit Configurations...

最下面有报错信息

将Use classpath of module选择成新建的module的名字,这里我新建的midule的名字是web

选完之后,报错消失,项目即可正常启动

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
可以使用Java中的FTP客户端来实现将Spring Boot项目中的文件上传到FTP服务器。以下是一个基本的实现步骤: 1. 引入FTP客户端的依赖,比如 Apache Commons Net。 2. 创建FTP客户端对象,连接FTP服务器。 3. 使用FTP客户端对象上传文件到FTP服务器。 下面是一个示例代码: ```java import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class FtpUtil { public static void uploadFile(String server, int port, String username, String password, String remotePath, String filename, File localFile) throws IOException { FTPClient ftpClient = new FTPClient(); try { ftpClient.connect(server, port); ftpClient.login(username, password); ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); boolean created = ftpClient.makeDirectory(remotePath); if (created) { System.out.println("Remote directory created successfully."); } ftpClient.changeWorkingDirectory(remotePath); FileInputStream inputStream = new FileInputStream(localFile); boolean uploaded = ftpClient.storeFile(filename, inputStream); if (uploaded) { System.out.println("File uploaded successfully."); } inputStream.close(); } finally { ftpClient.logout(); ftpClient.disconnect(); } } } ``` 在上面的代码中,我们创建了一个FTP客户端对象,连接到FTP服务器,然后设置了FTP客户端的工作目录,最后上传了本地文件到FTP服务器。你可以根据自己的需求修改这个代码,比如入异常处理等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值