0

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 enter image description here
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.

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much. Sorry for delay reply as I was figuring out how to do it in pom file. After adding that it works now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.