I want to open an Excel-file with Java.
I saw this Opening an Excel file using the default program and this works perfectly.
(In short the solution would be:)
Desktop dt = Desktop.getDesktop();
dt.open(new File(this.outputFilePath));
or
Process p =
Runtime.getRuntime()
.exec("rundll32 url.dll,FileProtocolHandler " + this.outputFilePath);
But I also want to know when the Excel-file is closed again. Am I able to track, if the user closes the Excel-sheet? And would I use the process or the desktop-solution for this? What is the difference between this solutions?
I want to create an E-Mail after closing the Excel-file.
Thanks to the comments
I have a solution now.
ProcessBuilder pb = new ProcessBuilder("cmd.exe","/c",path);
Process p = pb.start();