由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Issue when running a unix command with Runtime.getRuntime.exec()
相关主题
法国电信的测试题大家在工作中遇到过什么很难的问题(技术上)
java dumb questionhow to use grep/sed to remove newlines? (转载)
Re: Java里怎么调用unix下的command?build.xml
怎样在JBuilder里输入这样的command?hadoop quickstart 疑问
cool JS/UIXRe: Where can i find this package?
error of unix redirecting command called by java求助Java Image Tools or API
how to set up multiple delimiter?纽约附近的兄弟有想一起做个交易系统的吗?
HTTP Status 404 The requested resource (/abc/index.jsp) is not available.Re: Do anyone know a good websit containing the source code of Java
相关话题的讨论汇总
话题: command话题: issue话题: unix话题: mkdir话题: string
进入Java版参与讨论
1 (共1页)
h*****a
发帖数: 1718
1
I am using Runtime.getRuntime.exec() to run the following unix command to
create a directory on a remote host.
ssh user@host "mkdir -p 'test'"
and it complains with the error below
zsh: no such file or directory: mkdir -p 'test'
Seems it incorrectly thinks the command after ssh is a file name.
Does anyone know how to fix it?
g*****g
发帖数: 34805
2
Put the command in a script file, and run that script instead,
it's probably easier that way.

【在 h*****a 的大作中提到】
: I am using Runtime.getRuntime.exec() to run the following unix command to
: create a directory on a remote host.
: ssh user@host "mkdir -p 'test'"
: and it complains with the error below
: zsh: no such file or directory: mkdir -p 'test'
: Seems it incorrectly thinks the command after ssh is a file name.
: Does anyone know how to fix it?

h*****0
发帖数: 4889
3
when you get complicated options in you command, try to use this edition of
exec:
Runtime.exec(String[] cmdarray)

【在 h*****a 的大作中提到】
: I am using Runtime.getRuntime.exec() to run the following unix command to
: create a directory on a remote host.
: ssh user@host "mkdir -p 'test'"
: and it complains with the error below
: zsh: no such file or directory: mkdir -p 'test'
: Seems it incorrectly thinks the command after ssh is a file name.
: Does anyone know how to fix it?

h*****a
发帖数: 1718
4
Thanks for all replies. Changing to the API using the array argument solves
this problem.
The documentation of the Runtime class is not clear about the difference of
these different APIs.

of

【在 h*****0 的大作中提到】
: when you get complicated options in you command, try to use this edition of
: exec:
: Runtime.exec(String[] cmdarray)

h*****0
发帖数: 4889
5
well, it says the single String argument will be splitted by StringTokenizor
, and then apply the array edition. I guess a careful study of
StringTokenizor would makes you able to use the single String argument
edition. It's just unnecessary.

solves
of

【在 h*****a 的大作中提到】
: Thanks for all replies. Changing to the API using the array argument solves
: this problem.
: The documentation of the Runtime class is not clear about the difference of
: these different APIs.
:
: of

1 (共1页)
进入Java版参与讨论
相关主题
Re: Do anyone know a good websit containing the source code of Javacool JS/UIX
Which one is easier? thank you very much!error of unix redirecting command called by java
jar 的问题, 路径有问题? 大家帮忙看看是啥毛病?how to set up multiple delimiter?
Problem solved by Re: Desperately need help on DB2 connection through jdbc in jsp pageHTTP Status 404 The requested resource (/abc/index.jsp) is not available.
法国电信的测试题大家在工作中遇到过什么很难的问题(技术上)
java dumb questionhow to use grep/sed to remove newlines? (转载)
Re: Java里怎么调用unix下的command?build.xml
怎样在JBuilder里输入这样的command?hadoop quickstart 疑问
相关话题的讨论汇总
话题: command话题: issue话题: unix话题: mkdir话题: string