I would like to set a breakpoint in the application before it starts, so that I can make sure that the application does not pass a breakpoint at startup.
To set a breakpoint, you need to do something like:
EventRequestManager reqMan = vm.eventRequestManager(); BreakpointRequest bpReq = reqMan.createBreakpointRequest(locationForBreakpoint); bpReq.enable();
To get the location of the breakpoint, you can do something like:
Method method = location.method(); List<Location> locations = method.locationsOfLine(55); Location locationForBreakpoint = locations.get(0);
To get the method, you can do something like:
classType.concreteMethodByName(methodNname, String signature)
However, in order to get this class, it seems to you that you need an ObjectReference, which seems to require a working JVM.
Is there a way to set a breakpoint before starting the application JVM, to be sure that the breakpoint will not be passed during the launch of the application?
source share