可能是找不到打开的程序,这里用记事本打开时肯定可以的
rt.exec("cmd /c start notepad " + f.getAbsolutePath());
rt.exec("cmd /c start notepad " + f.getAbsolutePath());
解决方案 »
- JAVA初级程序员
- 如何使用正则添加img标签的max-width属性
- 如何给Frame添加一个背景图片
- ========很简单,但我不明白......========
- 垃圾回收的小问题,请大家发表见解
- 如解决,明早结贴:点击窗口A一按钮,显示窗口B,同时窗口A关闭,为什么A关不掉,而是其窗体变成空白???
- 一个很诡异的问题!!
- Rebocode中的时间单位是怎么定的?在线等!!!半小时结帐!!!
- 为什么运行时jtable中会出现两遍数据
- 对面的高手看过来。(IP,DNS)
- 小女子求助,帮我看看用什么模式开发比较好,用什么工具配置,有好的方式的给200分。
- 怎样根据JLabel的宽度,自动修改其显示的数字?
I think it is impossible. .
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() + ")" );
}
}
rt.exec("cmd /c start " + "test.gif");
怎么又可以