Normally to attach a debuger to a running jvm you would need start the jvm with arguments such as the following:
> java -Xdebug -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n
Now if I want to debug a process that wasn't started in debug mode, what can I do?
This situation arrises when a production system (i.e. started without debug args) exhibits a 'random' (I use the term loosely) bug. So I can't restart the jvm with the appropriate arguments, because nobody knows how to reproduce the bug again. Is it impossible to attach to the JVM in this situation?
Just to clarify it is not possible to use tools like jdb to attach to already running JVMs unless they were started in debug mode
from the JVM man page
Another way to use jdb is by attaching it to a Java VM that is
already running. A VM that is to be
debugged with jdb must be started with
the following options:
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…