public static boolean isDebuggingEnabled ( ) { boolean debuggingEnabled = false ; if ( ManagementFactory . getRuntimeMXBean ( ) . getInputArguments ( ) . toString ( ) . indexOf ( "-agentlib:jdwp" ) > 0 ) { debuggingEnabled = true ; } else if ( ManagementFactory . getRuntimeMXBean ( ) . getInputArguments ( ) . contains ( "-Xdebug" ) ) { debuggingEnabled = true ; } else if ( System . getProperty ( "debug" , "" ) . equals ( "true" ) ) { debuggingEnabled = true ; } return debuggingEnabled ; }
Examines some system properties to determine whether the process is likely being debugged in an IDE or remotely .