At some point you'll need to revert to native code in order to interact to the other apps running on your desktop. You can read up on
JNI and
javah. Basically the low-level system handling - i.e. the part where your app closes all the other apps running on the desktop - will have to be done in a custom written C library (for instance in a DLL file). Then you tie your Java code to this DLL file; for instance in your Java code you create a method that calls the new function in your C library that handles the closing of all other apps on your desktop.