Reputation: 599
I have a very simple project here https://github.com/sherry-ummen/javadebuggingnotworking
I am trying to get remote debugging working because I need it to do it for a similar case so I thought of trying it out with a simple one.
I have put a break point at line 12. Did maven build to create the jar and also set the remote debugging configuration to this
And to start debugging I used the following command
java -Xdebug -Xrunjdwp:transport=dt_socket,address=8998,server=y -jar my-debug-test-0.0.1-SNAPSHOT.jar
Now when the process is listening , I go to IntelliJ and press remote debugging configuration then I get the following message on the Intellij output window without hitting the breakpoint.
Connected to the target VM, address: 'localhost:8998', transport: 'socket'
Disconnected from the target VM, address: 'localhost:8998', transport: 'socket'
And also in the console window where I started the java process gets stopped with the following message
C:\Users\sherry.ummen\eclipse-workspace\my-debug-test\target>java -Xdebug -
Xrunjdwp:transport=dt_socket,address=8998,server=y -jar my-debug-test-0.0.1-
SNAPSHOT.jar
Listening for transport dt_socket at address: 8998
no main manifest attribute, in my-debug-test-0.0.1-SNAPSHOT.jar
Now, I really do not understand why it behaves this way and I do not see my breakpoint hitting. It might be a very stupid question but I have very limited Java development skills so for me it's a headache.
Upvotes: 0
Views: 1289
Reputation: 4183
in your case IDEA or Eclipse has successfully connected to the process. problem is , in your jar there no defined main class (should be defined in the manifest). so java process will be immediately stop because it has no main class to run.
in the jar , META-INF filder, there should be a file names MANIFEST.MF, in that file there should be a entry like this
Main-Class: mypackage.MyMainClass
Upvotes: 1