有些人可以告诉我如何连接UNIX服务器(EX:apsf2221)。我需要从unix服务器复制文件到我们的本地桌面
String SFTPHOST = "apsf2221";
int SFTPPORT = 22;
String SFTPUSER = "abc001";
String SFTPPASS = "abc123";
String SFTPWORKINGDIR = "/batchroot/XML/prod2/status_archive/*.txt";
当我连接到服务器时,我收到以下错误。
java.io.FileNotFoundException: /batchroot/XML/prod2/status_archive/*.txt (The system cannot find the path specified)
代码:
JSch jsch = new JSch();
session = jsch.getSession(SFTPUSER, SFTPHOST, SFTPPORT);
session.setPassword(SFTPPASS);
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
channel = session.openChannel("sftp");
channel.connect();
channelSftp = (ChannelSftp) channel;