try {
Runtime.getRuntime().exec("excel C:\\file.xls");
} catch (IOException ex) {
System.out.println(ex);
}
Doesn't work. I have to put the full path of excel.exe in order to work. How can I make it generic (For any Excel Folders/Versions)? When I run the same line from OS with Windows Run (Start --> Run) it works. Is there a code in Java to simulate Windows' Run command?