I would like to do some debugging on a Java program running on Windows: backtrace, print some variables, set breakpoints, single-step through a critical function.
The first thing I tried was jdb -attach 5312
. This failed with "shmemBase_attach failed: The system cannot find the file specified". I found some related questions about that error message but they seem to be talking about a more complex scenario involving debugger and target on separate hosts.
What I'm doing is a local process attach, so I think it should be easier. But there is something making it harder.
The target process isn't run as java -jar foo.jar
or anything normal like that. It's an application-specific EXE file wrapping the java code. It identifies itself in a process listing as "Commons Daemon Service Runner" and looking at the strings inside it, it seems to be the prunsrv
program from Apache Commons Daemon.
Process Explorer tells me that there are no command line arguments, and the process is a child of services.exe. I have the ability to start and stop it from Windows Services, but I don't know how to do anything else with it.
The jps
command doesn't show this process, but I know that it is a Java program... lightly wrapped. Is there any way to debug it?