cmd /c start c:\a.txt能打开文件,而且内存中也没有cmd进程
如下代码实现dmp --> Oracle,数据表也能导入到Oracle里,但是没法获得返回值,imp进程始终在内存里,如何自动导入完关闭该进程?
sCommand = "c:/oracle/ora81/bin/imp.exe" /c qd/qd@qdDB file='c:\school.dmp' FROMUSER=abc TABLES=Student
process = Runtime.getRuntime().exec(sCommand);
if(process.waitFor() == 0){
return "1";
}else{
return sCommand;
}
如下代码实现dmp --> Oracle,数据表也能导入到Oracle里,但是没法获得返回值,imp进程始终在内存里,如何自动导入完关闭该进程?
sCommand = "c:/oracle/ora81/bin/imp.exe" /c qd/qd@qdDB file='c:\school.dmp' FROMUSER=abc TABLES=Student
process = Runtime.getRuntime().exec(sCommand);
if(process.waitFor() == 0){
return "1";
}else{
return sCommand;
}
public class Test {
public static void main(String[] args) throws IOException,InterruptedException
{
String cmd = "cmd /c exp pda/pwpda@SISSI file=c:/pdadb.dmp grants=y log=c:/pdadb.txt tables=(user_col_comments)";
Process process1 = Runtime.getRuntime().exec(cmd);
if (process1.waitFor() == 0)
Thread.sleep(10);
Runtime.getRuntime().exec("cmd /c start c:\\pdadb.txt");
}
}