Runtime.exec(...)自己再找一下JDK的API document吧,具体参数的含义。

解决方案 »

  1.   

    public void backup()
    {
    String exp = "f:\\oracle\\ora81\\bin\\exp aa/aa@3000 file=aaa.dmp indexes=y rows=y grants=n log=log.txt";

    Process p = null;
    try
    {
    p = Runtime.getRuntime().exec(exp);
    //p.waitFor();
    p.exitValue();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    }
      

  2.   

    提示:java.lang.IllegalThreadStateException: process has not exited
    at java.lang.Win32Process.exitValue(Native Method)
    at com.huahang.rotor.TestMain1.<init>(TestMain1.java:241)
    at com.huahang.rotor.TestMain1.main(TestMain1.java:257)是怎么回事?
      

  3.   

    import java.io.IOException; 
    import java.io.PrintStream; 
    public class runCmd 

     public boolean run(String comm) 
     { 
         boolean flag = false; 
         try 
         { 
             Runtime.getRuntime().exec(comm); 
             bRet = true; 
         } 
         catch(IOException ex) 
         { 
             System.out.println(ex.getMessage()); 
         } 
         return flag; 
     }  public static void main(String args[]) 
     { 
         runCmm rc = new runCmm(); 
         rc.run("explorer.exe");
     } 
      

  4.   

    String exp="";可能是你命令写错了,贴出来看看。
      

  5.   

    zmrljl(javaone) 你的程序有一点点小笔误。import java.io.IOException; 
    import java.io.PrintStream; public class runCmd 

     public boolean run(String comm) 
     { 
         boolean flag = false; 
         try 
         { 
             Runtime.getRuntime().exec(comm); 
             flag = true; 
         } 
         catch(IOException ex) 
         { 
             System.out.println(ex.getMessage()); 
         } 
         return flag; 
     } 
     public static void main(String args[]) 
     { 
         runCmd rc = new runCmd(); 
         rc.run("explorer.exe");
     } 

      

  6.   

    搭车问一下,如果执行的是ipconfig ping之类的没有窗体的程序,运行结果怎么获得?
    我刚开始学java,对这个问题比较感兴趣。
    3x
      

  7.   

    你们的意思~~我得明白~~执行其他命令好使但是为什么执行exp80的时候那个黑匡是出来了,但是也没有执行呀!就停在那里了:(我把那个命令考到cmd里执行也好使呀!在java里执行exp80是不是有什么环境变量呀!请各位帮忙呀!
      

  8.   

    命令是:D:\\orant\\BIN\\EXP80.EXE user/pass@3000 file=d:\temp\2002-08-05.dmp indexes=y rows=y grants=n log=log.txt