我正在尝试使用java从svn
下载zip文件,但没有任何结果。
通过命令提示符,它会被下载,所以我想通过java
执行命令提示符。
我的java
代码是:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class aaa {
public static void main(String[] args) throws IOException, InterruptedException {
String command = "svn co --username username --password pass http://interactive/svn/Test_Mariza/trunk/test/seatapps.zip /home/vaishali/aaa/";
Process proc = Runtime.getRuntime().exec(command);
// Read the output
BufferedReader reader =
new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = "";
while((line = reader.readLine()) != null) {
System.out.print(line + "\n");
}
proc.waitFor();
}
}
我作为参数传递的命令是通过终端执行但不通过java代码执行。 谁能帮我吗。
答案 0 :(得分:-2)
在Java中执行命令:
Runtime.getRuntime().exec(" Insert command here ");