4

In theory, the JDB (java debugger) allows for a single thread to be killed. In practice, is it possible? Here I attach jdb to my JVM, which has an agentlib at port 8000:

$ jdb -attach 8000
> 

I list the threads:

> threads
Group system:
  (java.lang ...
  [...]

I find the thread in question and try to kill it:

> kill 0x21bb new java.lang.Exception("die!")
killing thead: pool-766-thread-1
> com.sun.tools.example.debug.expr.ParseException: Unable to create java.lang.Exception instance
Expression must evaluate to an object

So threads cannot be killed?

How can one create a new Exception in the jdb, to give it to the thread to die?

Albert Cardona
  • 221
  • 2
  • 8
  • The semicolor does not make a difference (tested it), and the poster in the "here" link that you added also says that he cannot kill the thread either. – Albert Cardona Nov 30 '11 at 20:52

2 Answers2

1

The following answer on SO does seems only to enforce your question.

But the following answer probably does answer your question...

Community
  • 1
  • 1
Yaneeve
  • 4,751
  • 10
  • 49
  • 87
0

It is possible you have jconsole/jvisualvm also running. I had the same issue, but then I closed jconsole, the jdb kill command worked.

Kalyan Ghosh
  • 483
  • 11
  • 12