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.

check here. checks jdwp.

basically:

boolean isdebug = java.lang.management.managementfactory.getruntimemxbean().     getinputarguments().tostring().indexof("-agentlib:jdwp") > 0; 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -