String f="c:\\rpaths.txt";
       Runtime r = Runtime.getRuntime();
      try {
        r.exec("start " + f);
      }
      catch (IOException ex) {
      }
这么做打不开,该怎么操作???

解决方案 »

  1.   

    class A{
    public static void main(String[] arg){
    String f="1.txt";
           Runtime r = Runtime.getRuntime();
          try {
            r.exec("notepad "+f);
          }
          catch (Exception ex) {
          }
    }}
      

  2.   

    这个是打开doc文件的
    class A{
    public static void main(String[] arg){
    String f="1.doc";
           Runtime r = Runtime.getRuntime();
          try {
            r.exec("C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.EXE "+f);
          }
          catch (Exception ex) {
          }
    }}C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.EXE 是你word的安装路径.
      

  3.   

    谢谢,txt的通过了。怎么能让系统知道word或者acrobat安装在哪个路径,然后直接调用呢?如果使用绝对路径,有的机器安装的不是xp,而是word2000。