java 打开txt文件或者bat文件

package open_exe;

public class OpenExe {
      public static void openWinExe() {
          Runtime rn = Runtime.getRuntime();
          Process p = null;
          try {
          String command = "notepad";
          p = rn.exec(command);
          } catch (Exception e) {
          System.out.println("Error win exec!");
          }
          }
          //调用其他的可执行文件,例如:自己制作的exe,或是 下载 安装的软件.QQScLauncher.exe
          public static void openExe() {
          Runtime rn = Runtime.getRuntime();
          Process p = null;
          try {
          p = rn.exec("cmd /k start C:\\easydarwin\\EasyDarwin\\EasyDarwin\\start.bat");
          } catch (Exception e) {
          System.out.println("Error exec!");
          }
          }
          public static void openExe1() {
              Runtime rn = Runtime.getRuntime();
              Process p = null;
              try {
              p = rn.exec("C:\\应用管理\\qq\\Bin\\QQScLauncher.exe");
              } catch (Exception e) {
              System.out.println("Error exec!");
              }
              }
    public static void main(String[] args) {
        // TODO 自动生成的方法存根
        openExe1();

    }

}

 

posted on 2016-12-13 14:08  取个名字之麻烦  阅读(181)  评论(0)    收藏  举报