How to find out if “debug mode” is enabled

I found it out myself now:

boolean isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().
    getInputArguments().toString().indexOf("jdwp") >= 0;

This will check if the Java Debug Wire Protocol agent is used.

Leave a Comment