Java如何调用外部Exe程序?

匿名网友 匿名网友 发布于: 2015-08-30 00:00:00
阅读 133 收藏 0 点赞 0 评论 0

可以用一下代码来调用外部的EXE程序:

public class JavaInvokeExe
{
          public static void main(String args[])
          {
                     Runtime rt = Runtime.getRuntime();
                     Process p = null;
                     String exeFilePath = “”;
                     try{
                                    exeFilePath = “D:/sample.exe”;
                                    p = rm.exec(exeFilePath);
                     }catch(Exception e)
                     {
                              //TODO do something here
                     }  

          }

}

评论列表
文章目录