Skip to content

Java sftpChannel put error (The system cannot find the path specified)

I am going to transfer files to remote sftp by Java sftpchannel. Everything are going to be as expected. It was well tested on STS (Spring Tool Suite 4.7.1). But it failed when it was deployed to tomcat server.

// Logs

File path: S:/System/AutoSend/Data.json

Remote path: Data.json

Before sftp put

Sftp error: 4: S:SystemAutoSendData.json (The system cannot find the path specified)

(Unix-formated path has been transformed to windows format automatically?)

What can I do to fix the issue? Thanks a lot.


Have you tried making the File Path a String? Like this: “S:/System/AutoSend/Data.json” and is the “S” Drive on your Tomcat-Server? If not, try using the IP-address instead.