Below is the exception thrown when trying to open a create new email for outlook.
Exception :
java.io.IOException: Cannot run program "C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE /c ipm.note": CreateProcess error=2, The system cannot find the file specified
Exception occurs at first line of below code snippet :
ProcessBuilder processBuilder = new ProcessBuilder("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\OUTLOOK.EXE /c ipm.note");
try {
processBuilder.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
When I donot specify the switch /c ipm.note
the code works fine and a new outlook window opens up. But with the switch I get exception. Not sure what's the reason.
I referred following stackoverflow post : https://stackoverflow.com/a/6045897/2915738 and the related site : https://www.outlook-tips.net/how-to/using-outlook-command-lines/
Please guide me. Let me know if you need some more info.