java - JSCH: No such file error -
i have windows machine running ssh server. know path on machine. let d:/folder1/folder2
. i'm creating sftp channel using jsch. when try cd d:/folder1/folder2
, "no such file: 2"
error throwed.
can please help? may need convert path?
i've solved problem using channelexec opening exec channel. worked me. hope work others too.
... java.util.properties config = new java.util.properties(); config.put("stricthostkeychecking", "no"); jsch ssh = new jsch(); session = ssh.getsession(sshsolrusername, sshsolrhost, 22); session.setconfig(config); session.setpassword(sshsolrpassword); session.connect(); channel = session.openchannel("exec"); ((channelexec)channel ).setcommand("cd " + sourcepath); exec.setinputstream(null); ((channelexec)channel ).seterrstream(system.err); inputstream in = channel .getinputstream(); channel .connect(); int status = checkstatus(channel , in); channel.disconnect(); ...
Comments
Post a Comment