3

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 Answers 2

5

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

enter image description here

  • 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

1
  • 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, 2020 at 16:59
0

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

3
  • I am getting unable to open debugger port(IP:porntno) java.io.IOExceptionerror
    – Aamir
    Dec 2, 2015 at 10:21
  • 2
    now its working , this stackoverflow.com/questions/30858312/… really helped
    – Aamir
    Dec 2, 2015 at 10:47
  • 2
    The link in the answer no longer exists. Anyone know if there's an updated page?
    – Lexi
    May 16, 2017 at 17:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.