我要在D:/u3/aa目录下
执行一条”svn checkout https://DESKTOP-BU9I9BB:4433/svn/my/M3 –username 111 –password 111” 命令
使用Runtime.exec(String[] cmdarray, String[] envp, File dir);
cmdarray是参数数组, envp为null即可, dir为目录的File对象
import java.io.File;
public class Test {
public static void main(String[] args) {
String path = "D:/u3/aa";
File file = new File(path);
String[] cmd = new String[]{"svn","checkout","https://DESKTOP-BU9I9BB:4433/svn/my/M3","--username","111","--password","111"};
Runtime runtime = Runtime.getRuntime(); //得到本程序
try {
Process process = Runtime.getRuntime().exec(cmd, null, file);
} catch (Exception e) {
e.printStackTrace();
}
}
}