1.打开某个软件
try {
String s = "notepad.exe";
//这个只是打开某个软件
Runtime.getRuntime().exec(s);
//用某个软件打开某个文件
String f="notepad.exe c:\\1.txt";
Runtime.getRuntime().exec(f);
}
catch (Exception e)
{
System.out.println("!");
}
2.打开并且把它关掉
try {
String s = "notepad.exe";
//打开某个软件
Process p=Runtime.getRuntime().exec(s);
Thread.sleep(3000);
//杀掉这个进程
p.destroy();
}
catch (Exception e)
{
System.out.println("!");
}