debugging - How to find out if a Java process was started in debugger? -
i use timer call system.exit in order kill throw-away code snippet after few seconds, quite useful in case eats 100% cpu , windows gets irresponsible because of this. it's quite handy, except in case start in debugger. in debugger i'd disable automatically, otherwise forget , debugged process gets killed. can find out if process started in debugger?
note: know should not use serious. i'm not going to.
basically:
boolean isdebug = java.lang.management.managementfactory.getruntimemxbean(). getinputarguments().tostring().indexof("-agentlib:jdwp") > 0;
Comments
Post a Comment