可能是找不到打开的程序,这里用记事本打开时肯定可以的
 rt.exec("cmd /c start notepad " + f.getAbsolutePath());

解决方案 »

  1.   

    >可能是找不到打开的程序
    I think it is impossible. .
      

  2.   

    http://www.rgagnon.com/javadetails/java-0014.htmlCapture the output of JAVAC
    method 1a : redirect to a file    // Win95 (?)
       javac -J-Djavac.pipe.output=true myClass.java >output.txt
       // WinNT (or better)
       javac myClass.java 2>output.txt
     
    method 1a : redirect to stdout with a pause after each screen full    // WinNT (or better)
       javac myClass.java 2>&1 | more
     
    method 2 : use JAVA to capture the output //  [JDK 1.1]
    //  to compile:  java JC mySource.java
    //       (use redirection to keep the output)
    //               java JC mySource.java >output.txtimport java.io.*;
    public class JC {
      public static void main( String args[] )
         throws IOException, InterruptedException {
        String fn = "JC.java";
        if( args.length > 0 ) fn = args[0];
        System.out.println( "BEGIN (" + fn + ")" );
        Process p = 
            Runtime.getRuntime().exec( "javac -verbose " + fn );
        String buf;
        BufferedReader se = new BufferedReader
            ( new InputStreamReader( p.getErrorStream() ) );
        while( (buf = se.readLine()) != null ) 
           System.out.println( " : " + buf );
        System.out.println( "END (rc:" + p.waitFor() + ")" );
        }
      }
     
      

  3.   

    找不道程序是一个问题,但还有一个问题
    rt.exec("cmd /c start  " + "test.gif");
    怎么又可以