使用Apache commons读取多字符串参数

时间:2011-03-27 19:27:54

标签: java apache-commons apache-commons-cli

o.getValue()返回选项的值。

但是对于多个arg输入,比如-h this is a heading,该函数只返回第一个字符串' this ';我如何获取完整的参数:this is a heading

1 个答案:

答案 0 :(得分:2)

这可能是shell解析命令行的问题。我所知道的所有shell都将单词分解成单独的参数,你需要使用引号来解决这个问题。 -h "this is a heading"所有炮弹都以这种方式运作,我不相信你可以用Java解决这个问题。