Solved Intellij Run/Debug Config... Stop Server?

Discussion in 'Spigot Plugin Development' started by FakeSaint, Aug 5, 2018.

  1. I'm using an Intellij run/debug configuration to build my project and stop my local test server. Its great, the only issue is occasionally I accidentally run the server without having first stopped the first server instance. At that point I get an error because the old server instance is still running on the port the new one is trying to run on.

    So... Is there a good way to stop the old server instance once you no longer have access to its console? Currently I just restart completely

    Even better, is there a way to send the /stop command to the old server instance in the "Before Launch" section of the run/debug configuration? This would ensure the old server has closed before it starts the new one. No matter how hard I try the mistake is inevitableo_O
     
  2. I'm never tried doing that, but when you stop it through intellij, can't you make it stop the server ? This way you run when you wanna test something and stop when you're done... But as I said, I never tried it so maybe I'm wrong.
     
  3. Yea that is how it works, you can just /stop within intellij or stop the process but too often I forget to do so and it takes me to a halt.

    I'm looking for a way to stop the server after you lose focus to its command line... Surely it must be possible. Currently I either have to kill java or restart
     
  4. You can set a run configuration to be "single instance only" by ticking the checkbox in the top right of the run configuration window (the one where you also set the path to jar). IntelliJ then warns you if you run it a second time, prompting you to either cancel the second running or kill the first instance.
     
  5. When you run something, in the run popup there should be a tab for each running instance - you can press stop on the old tab

    [​IMG]
     
    • Winner Winner x 1
  6. Perfect! Thanks I never noticed that, exactly what I was hoping for