【发布时间】:2011-09-09 05:36:18
【问题描述】:
smoeone 是否可以尝试使用 Jsch 将多个文件发送到远程服务器,这可能吗!!
我正在尝试发送多个脚本 perl 来检查远程服务器中的一些现有文件和命令,然后必须在我的本地计算机中返回一个包含结果的文件,问题是我必须使用 eclipse那。
错误:
Bareword found where operator expected at /root/port.pl line 27, near "10.156.31.46 ssh"
(Missing operator before ssh?)
Bareword found where operator expected at /root/port.pl line 27, near "8HcmdrGQDgXKL"
(Missing operator before HcmdrGQDgXKL?)
Bareword found where operator expected at /root/port.pl line 27, near "9N1XgcLKUcC1DgFmcYoNLb1VsU9KYRhLAOGiIjWBdRkr6gLhZTJsnd2e464"
(Missing operator before N1XgcLKUcC1DgFmcYoNLb1VsU9KYRhLAOGiIjWBdRkr6gLhZTJsnd2e464?)
Bareword found where operator expected at /root/port.pl line 27, near "2iIe3zJSlBH1tVd8PCifJaZ6Xu4KqsDFWjIILv8wY5XMWYdxVcPcMOsQhpl7vB2EgZxrc3yxE6rwfGnyxEKWez9W9t6e2hOvx3J21PxAGTaCIPjgxbcM4G"
(Missing operator before iIe3zJSlBH1tVd8PCifJaZ6Xu4KqsDFWjIILv8wY5XMWYdxVcPcMOsQhpl7vB2EgZxrc3yxE6rwfGnyxEKWez9W9t6e2hOvx3J21PxAGTaCIPjgxbcM4G?)
syntax error at /root/port.pl line 27, near "10.156.31.46 ssh"
Execution of /root/port.pl aborted due to compilation errors.
exit-status: 255
当我使用 FileOutput 时出现此错误
java.io.FileNotFoundException: C:\Users\Computer\workspace\proj (Accès refusé)
【问题讨论】:
-
您要上传多个文件,还是执行它们,或者两者都执行?
-
你的代码有什么问题?你有例外吗?它做的不是你想要的(如果是,是什么?)。
-
它给了我这个异常:
java.lang.ArrayIndexOutofBoundsException:0并且 cmd 不在远程服务器中执行 -
请多合作一点。这个异常发生在哪一行?我的猜测是在
new FileInputStream(args[0])- 这只有在您使用文件名作为命令行参数调用程序时才有效(同样的参数也用作主机名)。在您的情况下,您不需要任何输入,因为您上传了脚本 - 只需使用channel1.setInputStream(null)代替。 -
异常消失,但命令没有在远程服务器中执行