This method of the Debugger Class determines if a debugger is attached to the current process.
public static native boolean isDebugging ();
True if a debugger is attached.