Have written a program to open Excel sheet from java program.
Below line works fine.
Process p = Runtime.getRuntime().exec(new String[]{"\"C:\\Program Files (x86)\\Microsoft Office\\Office12\\Excel.EXE\"","C:\\Users\\RASHPA~ 1.ORA\\AppData\\Local\\Temp\\Export_xl420314062726 9379706.xls"});
But below code gives error i.e. Executable name has embedded quote, split the arguments
String path = "C:\\Program Files (x86)\\Microsoft Office\\Office12\\Excel.EXE";
String file = "C:\\Users\\RASHPA~1.ORA\\AppData\\Local\\Temp\\Ex port_xl4203140627269379706.xls";
Process p = Runtime.getRuntime().exec(new String[]{"\""+path+"\"" + ","+file});
I am using java 1.6.