默认不支持桌面程序调用,需要添加该句设置才能调用 
 System.setProperty("java.awt.headless", "false");
Desktop.getDesktop()能打开本地浏览器,exe程序,发送邮件等。
@GetMapping("/startUpXFExe")
public String startUpXFExe(/*@RequestParam("exePath") String exePath*/) {
//exe存放路径
String exePath = "C:\\Program Files (x86)\\Tencent\\WeChat\\WeChat.exe";
//打开桌面程序调用 默认不支持
System.setProperty("java.awt.headless", "false");
if (isSupported()) {
try {
//启动exe执行程序
System.out.println("正在打开.exe程序");
Desktop.getDesktop().open(new File(exePath));
} catch (Exception e) {
e.printStackTrace();
log.error("程序:" + exePath + "不存在!");
return "程序:" + exePath + "不存在!";
}
return "程序启动成功";
}else {
return "不支持桌面程序";
}
}