java中怎么调用cmd的keytool命令
String cmd = "keytool -import -alias few - keystore "+"D:\\Users\\Administrator\\AppData\\Local\\Genuitec\\Common\\binary\\com.sun.java.jdk.win32.x86_1.6.0.013\\jre\\lib\\security\\cacerts"+" -file F:\\zs\\222.cer -trustcacerts";
execDos(cmd);
public static void execDos(String doscmd){
String[] cmd = new String[3];
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = doscmd;
try{
Process process = Runtime.getRuntime().exec (cmd);
}catch (
java.io.IOException e){
System.err.println ("
IOException " + e.getMessage());
}
}
为什么调用了还是需要你导入证书呢,是cmd的语句写的有问题吗?麻烦知道的朋友帮忙看看吧。
------解决方案--------------------
http://blog.csdn.net/iisgirl/article/details/7046081
你還是直接參考我的blog吧,