To start with JDB, it is required to connect it with the JVM. For that purpose, create a JDB session by any of the following ways:-
JDB Session using main class
This is one of the simplest way of creating JDB session. In this approach, JVM is released with the main class of the application which is required to debug.
Follow the below steps:-
Here, MainClass is the name of the class that is required to debug. You can take any name in place of it but that name must represent your main class.
JDB Session using JVM
Another approach for creating JDB session is to attach jdb command with the running JVM. This approach specifies the kind of connection to be made. Follow the below syntax:-
Apart from these two ways, there are various other ways that can be used to create a connection between debugger and JVM and jdb command supports all of them.