i have jar file which contains file with main method. I am running that main class with batch file (as some parameters are being set over there) I want to remote debug the program from eclipse. I am not getting how to proceed ?
-
https://stackoverflow.com/a/46171836/1619407 – Alessandro Giusa Sep 12 '17 at 08:48
1 Answers
0: You must have a project in Eclipse containing the java source code corresponding to the classes in the jar. (If the jar was produced from Eclipse this is a given.)
1: Start the "target" java process (JVM) with -agentlib:jdwp option as described in What are Java command line options to set to allow JVM to be remotely debugged? or http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/conninv.html (or earlier version as applicable). Note the value called "address" in lib-jdwp is really the port, and will be used as the port below.
2: In Eclipse Run / DebugConfigurations (also reachable from rightclick on the beetle icon) create an entry of type RemoteJavaApplication and select the project, and enter the host and port of the JVM you want to debug, and then hit the "Debug" button at the bottom to activate it. If the target is on the same host as Eclipse you can use localhost or 127.0.0.1 instead of bothering with the "real" name or IP. Once the target goes into debug state, Eclipse will switch to Debug perspective.
3: Squish those nasty bugs :)

- 1
- 1

- 34,712
- 6
- 50
- 70