简体   繁体   English

从命令行在Java程序中传递运行参数会产生错误

[英]Passing run arguments in a java program from command line gives an error

I have a simple java program which takes run arguments of length three , these are my arguments 我有一个简单的java程序,它的运行参数长度为3,这是我的参数

www\u_business_service.do namegt(test|dev)*.server-net.com  localhost.server-net.com

Although the program and the run-arguments run fine when I run it on eclipse, but when I try to do the same form the command prompt running it as 尽管在eclipse上运行程序和运行参数时运行正常,但是当我尝试执行相同的形式时,命令提示符运行为

java ReplaceText u_business_application.do namegt(test|dev)*.server-net.com  localhost.server-net.com

it gives me an error as : 它给我一个错误:

'dev)*.service-now.com' is not recognized as an internal or external command,
operable program or batch file

I assume it doesn't like the * or some other character, but is there a way around this? 我认为它不喜欢*或其他字符,但是有办法解决吗?

Thanks 谢谢

'|' '|' character (one that you between test and dev) is a pipe character, that tells you OS to start new program and pass output of first to input of second. 字符(您在test和dev之间的字符)是管道字符,它告诉OS启动新程序并将first的输出传递到second的输入。 Just embed your arguments into quotes. 只需将您的论点嵌入引号中即可。

java ReplaceText "u_business_application.do namegt(test|dev)*.server-net.com  localhost.server-net.com"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM