Debuggee node sends VMDeathEvent right after VMStartEvent | Java Debugging Interface

Viewed 30

I am developing a simple debugger using Java and Java Debugging Interface. I have two classes Debugger and Debuggee. Debugger class consists of logics for debugging. Debuggee class is the class that is being debugged.

GitHub link to the Project

When I run the application in the terminal it's working perfectly. In the Debugger VM it expects a few types of events.

  1. VMStartEvent
  2. ClassPrepareEvent
  3. BreakpointEvent
  4. VMDeathEvent
  5. VMDisconnectEvent

When running the application in the terminal it's working perfectly. The debuggee node sends ClassPrepareEvent and BreakPointEvents. But when run the application in IntelliJ it does not send ClassPreparationEvent and BreakPointEvent.

It sends VMDeathEvent right after VMStartEvent and then VMDisconnectEvent.

Why does this behavior happen? Is there any configuration that I should set in IntelliJ?

1 Answers

I had the exact same problem and I know this is old but in case anyone lands here after searching for this, here's what worked for me; you need to set the working directory in your run configuration to the target/classes directory of your project. e.,g, if your project is at /Users/name/project and your source is in /Users/name/project/src/main/java/ set the working directory to /Users/name/project/target/classes/

I wasted almost an entire day searching for an answer for this problem, turns out this error is caused by the VM not finding the compiled class file of the debuggee when run via the IDE because it sets the wrong working directory.

Related