How can I, from within a java program on windows, prevent a debugger window being displayed if a program I invoke crashes, and how can I detect the fact that it has crashed?
Background
I have a problem with a java application running on Windows which is launching an unreliable third party program by way of ProcessBuilder.start(). Specifically, if the external program crashes, the 'Visual Studio Just-In-time Debugger' window pops up asking if the user wants to debug the program.
From the java application side, I'm happy to deal with the fact that under some circumstances, the third party program will crash, but I'd like to be able to detect and silently handle that situation from within the Java code without requiring any user interaction.
Aside
Ideally I'd like to avoid having to require the end user to reconfigure their machine/server as described at http://msdn.microsoft.com/en-us/library/5hs4b7a6.aspx
After Visual Studio is installed on a server, the default behavior when an unhandled exception occurs is to show an Exception dialog that requires user intervention to either start Just-In-Time debugging or ignore the exception. This may be undesirable for unattended operation. To configure the server to no longer show a dialog when an unhandled exception occurs (the default behavior prior to installing Visual Studio), use the registry editor to delete the following registry keys:On a 64-bit operating system, also delete the following registry keys:
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger
- HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
- HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger