How can we debug a code in intellij which is present on a remote server?

You first need to start your remote server with debug port open (5005 for example) by set these arguments for JVM (put into the setenv.bat (Windows) or setenv.sh (Linux)):

set JVM_SUPPORT_RECOMMENDED_ARGS=-Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n

Then create a remote debug in your IntelliJ as you will do for local server, but point the host to your server:

5 Likes