public class ExecProc {
public static void runExecFile(String execFile) throws IOException
{
try{
Runtime.getRuntime().exec(execFile);
}catch(Exception ex){
throw new IOException(ex.getMessage());
}
}
public static void runExecFile(String execFile,boolean waitFlag) throws IOException
{
try{
Process proc = Runtime.getRuntime().exec(execFile);
System.out.println("test");
if (waitFlag)
proc.waitFor();
int exitVal = proc.exitValue();
System.out.println("Process exitValue: " + exitVal); }catch(Exception ex){
throw new IOException(ex.getMessage());
}
}
public static void main(String[] args)
{
try{
runExecFile("exp usr/pwd@sid file = d:\\test.dmp",true);
System.out.println("系统已启动");
}catch(Exception ex){
System.err.println(ex.getMessage());
}
}
}我要怎么控制proc 阿,现在是exp命令可以执行,但是程序始终不退出。
int exitVal = proc.exitValue();//这句始终执行不到
谢谢!
public static void runExecFile(String execFile) throws IOException
{
try{
Runtime.getRuntime().exec(execFile);
}catch(Exception ex){
throw new IOException(ex.getMessage());
}
}
public static void runExecFile(String execFile,boolean waitFlag) throws IOException
{
try{
Process proc = Runtime.getRuntime().exec(execFile);
System.out.println("test");
if (waitFlag)
proc.waitFor();
int exitVal = proc.exitValue();
System.out.println("Process exitValue: " + exitVal); }catch(Exception ex){
throw new IOException(ex.getMessage());
}
}
public static void main(String[] args)
{
try{
runExecFile("exp usr/pwd@sid file = d:\\test.dmp",true);
System.out.println("系统已启动");
}catch(Exception ex){
System.err.println(ex.getMessage());
}
}
}我要怎么控制proc 阿,现在是exp命令可以执行,但是程序始终不退出。
int exitVal = proc.exitValue();//这句始终执行不到
谢谢!
表示的是一个*.exe文件名吗?
意思就是说JAVA可以调用EXE这种可执行文件啊!
那真是太好了!
根据后一句的输出吗?后一句的输出是什么?