java代码中启动exe程序最简单的方法

使用awt的Desktop类的open方法:

public static void startExe(String exePath){
        try {
            if(StringUtils.isNotBlank(exePath)){
                Desktop.getDesktop().open(new File(exePath)); //exePath为exe路径
            }
        }
        catch (Exception e){
            e.printStackTrace();
        }

用于自动化测试前期的初始化操作,或exe运行

原创帖,转载请注明出处及作者,标注严禁转载帖请勿转载,谢谢!
原文地址:https://www.cnblogs.com/Bug-Hunter/p/15002434.html