[英]Passing variables to java process
I am not sure if this is possible but does anyone know if it possible to pass a variable to a java process? 我不确定这是否可行,但是有人知道是否可以将变量传递给Java进程吗?
My code is: 我的代码是:
Process process = Runtime.getRuntime().exec("cmd /c *curl command* -o "file.png");
And I want to do look something like: 我想看起来像:
int X = 0;
Process process = Runtime.getRuntime().exec("cmd /c *curl command* -o "fileX.png");
X++;
This way I can have output like: 这样,我可以有如下输出:
file0.png
file1.png
file2.png
Any help would be great. 任何帮助都会很棒。 Thanks in advance. 提前致谢。
You're essentially building a string. 您实质上是在构建字符串。
for (int x=0;x<MAX;x++){
String command = "cmd /c curl command -o \"file" + x + ".png\"";
// use it!
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.