I've been trying to use Java to execute Microsoft Excel in the coding by using the following code:
Process pro = Runtime.getRuntime().exec("open -a Microsoft"+"\\"+" "+"Excel");
pro.waitFor();
When I print this command out, it is exactly what I use to start a Excel in the command line manually, but when I want to start it by using java runtime, it is not working. I know in the Microsoft Windows command line there's no such problem, but in Mac is there any other way to start a program by using java code?
I also tried to start a Calculator by using the same code like:
Process pro = Runtime.getRuntime().exec("open -a Calculator");
It works perfectly, is it because the space between the "Microsoft" and "Excel"?