Intellij JAR Remote Debugging
Intellij JAR Remote Debugging
- Prerequisite: The code used to generate the JAR deployed on the remote location and the code on the local machine should be the same.
- Click on Edit Configurations option in Intellij and create a new Remote configuration
- Enter the Host IP in the Host field and the below command in the command line arguments for remote JVM field
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
- Save the remote configuration
- Put the necessary breakpoints in place
- Run the JAR on the remote server using the command
java -jar -Xmx2g -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 your-jar.jar argumen1 argument2
- You will see that your program is not executing but instead listening to the port you mentioned in the command
- Now select the remote configuration we created earlier in Intellij and click on Debug button, your code will now start executing and you will be able to debug the code.
Comments
Post a Comment