/**
* 启动应用程序
*
* @param programName
* @return
* @throws IOException
*/
public static void startProgram(String programPath) throws IOException {
log.info("启动应用程序:" + programPath);
if (StringUtils.isNotBlank(programPath)) {
try {
String programName = programPath.substring(programPath.lastIndexOf("/") + 1, programPath.lastIndexOf("."));
List<String> list = new ArrayList<String>();
list.add("cmd.exe");
list.add("/c");
list.add("start");
list.add("\"" + programName + "\"");
list.add("\"" + programPath + "\"");
ProcessBuilder pBuilder = new ProcessBuilder(list);
pBuilder.start();
// Desktop.getDesktop().open(new File(programPath));
} catch (Exception e) {
e.printStackTrace();
log.error("应用程序:" + programPath + "不存在!");
}
}
}