大家好,请问在JAVA语言里怎么作到打开一个记事本?
具体:当跳出一个FileDialog 时,选中一文件(TXT格式),按打开,然后就可以打开并编辑它~,谢谢大家!!

解决方案 »

  1.   

    可以使用线程中提到的exec("notepad") 方式打开记事本程序
      

  2.   

    使用exec方法,参数为程序的路径,注意windows路径中的\要用\\表示,就是使用转义字符
      

  3.   

    exec(String)
    在程序中执行指定的command命令 
    该方法与 exec(command, null) 同效。ps 建议搂主多看一下api文档,
    一起学习,呵呵
      

  4.   

    Runtime.getRuntime().exec(exeString)
    exeString = "cmd.exe /c start " + exeFileName
    exeFileName可以是任何可执行文件的文件名,要有路径
      

  5.   

    exeString = "cmd.exe /c start " + exeFileName
    Runtime.getRuntime().exec(exeString)
      

  6.   

    兄弟,这样做,我试过了!可以的!import java.io.IOException;public class HelloWorld { /**
     * @param args
     */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    System.out.println("HelloWorld!");
    String exeName = "notepad.exe";
    String fileName = " test.txt";
    String exeString = "cmd.exe /c start " + exeName + fileName;
    try {
    Runtime.getRuntime().exec(exeString);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }}