I am currently using intellij idea to code my project that I am working on, after creating of .jar
file using OneJar
command i deploy the .jar file on my linux server who address is something like 192.164.1.125
.there I run the command sudo nohup java -jar fileName.jar &
on server to start the jar file in the background and use the rest-client app to send rest calls to my .jar file.Whenever something goes wrong I can only see error message in nohup.out
file and what I actually wanted is to debug my jar file using intellij idea i.e how can I debug my .jar running on 192.164.1.125
using intellijIdea running on my client machine.I know I have to use that EditConfigurations option in run menu of intellij and provide IP and Port, but how to do it exactly.

- 2,380
- 3
- 24
- 54
2 Answers
You can do the remote debugging on IntelliJ IDEA 2019.2 version very easily!
- Click on "Run" -> "Edit Configurations"
- Click on "+" and select "Remote"
- Enter your remote IP and select source code folder path
- Optional : change the name and port of your wish
Run your remote server jar with the command which is mentioned in the Command line arguments for remote JVM box . something like this,
sudo nohup java "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8911" -jar fileName.jar &
You are all set. add the breakpoints and click on Debug symbol to debug your remote jar from local

- 81
- 2
- 6
-
When running a compiled application (say one or more jars created in the maven target directory) where do I add breakpoints ? The problem I see is that the code in the src/ folder is not the one being executed. Is there a way to add breakpoints into the jar , in intellij ? – bukli May 19 '20 at 16:59
You must run the remote "java -jar .." command in debug mode by adding the additional magic flags. You can then tell your local IntelliJ to create a new debug configuration targeting a remote application - IntelliJ provides the magic flags you need.
The help page for this feature is at https://www.jetbrains.com/idea/help/run-debug-configuration-remote.html

- 73,784
- 33
- 194
- 347
-
I am getting `unable to open debugger port(IP:porntno) java.io.IOException`error – Aamir Dec 02 '15 at 10:21
-
2now its working , this http://stackoverflow.com/questions/30858312/handshake-failed-connection-prematurally-closed-error-when-debugging-solr-in-i really helped – Aamir Dec 02 '15 at 10:47
-
2The link in the answer no longer exists. Anyone know if there's an updated page? – Lexi May 16 '17 at 17:57