[英]How can i pass parametersfrom a windows batch script to java
I need to read some parameters , which are defined in a windows batch script,in my java program... How can i define parameters..? 我需要阅读一些参数,这些参数是在Windows批处理脚本中的Java程序中定义的。我如何定义参数..? for eg I need to read a variable which is defined in the script; 例如,我需要读取脚本中定义的变量; variable v=XYX 变量v = XYX
i tried defining like(in the script); 我尝试定义(在脚本中)like;
java -Dvariable=XYX
but getting following exception; 但得到以下例外;
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
You have to call the main method of your class first 您必须先调用类的main方法
java com.xyz.MyClass -Dvariable=XYX java com.xyz.MyClass -Dvariable = XYX
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.