0

Is a Java program debuggable only when the VM is running in Debug Mode?
Is there any way to change it at runtime?

Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164
Peica
  • 31
  • 7

2 Answers2

1

No, there's no way to change it at runtime.

If at all possible, you will have to use a profiler

Community
  • 1
  • 1
Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164
  • I found the jinfo is available for changing some flags of VMs. But as you mean it could not be used to turn on something like the Debug mode, am I right? – Peica Mar 18 '11 at 17:40
  • ~O~. In my mind, I just consider the profiler as an performance analysis. Thanks I will have a try later. I am interested in what it could show out~ – Peica Mar 18 '11 at 17:47
0

I don't believe you can suddenly debug if it's not compiled with the -g option. Your only option is to recompile and redeploy. But once it's in place you can debug at will.

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • the question is about java not gcc – bestsss Mar 18 '11 at 17:33
  • Does that mean you guys normal use other facilities to find out the system problems like event log except the jdb? – Peica Mar 18 '11 at 17:36
  • When a running system meet an issue and the program is not running on debug mode, Should I trace out the problem via the event log? – Peica Mar 18 '11 at 17:38
  • In GDB world, I could load the symbols files into the debugger, when I need them. Do you mean the Java could not do it? – Peica Mar 18 '11 at 17:43