Search code examples
javaintellij-idealibgdx

How to reuse the window (or close the current one) when hitting the Run button?


I'm using IntelliJ to run my app. Is there a way to relaunch the window or close the current one when hitting the run button?

This is because when I hit the run button it creates a new window every time. It gets a bit tedious/confusing to close the previous window that is running old code.

enter image description here


Solution

  • Go to the Run menu and select Edit configurations...

    Select the configuration you've been using to run your project in the left panel. Either it's the Gradle yourProjectName:desktop [run] task, or it's an Application run configuration you've created yourself.

    Uncheck the box that says "Allow parallel run".

    The next time you try to run it when it's already running, it will warn you that it can only run it if it kills the old process. You can check a box in this dialog to do that automatically from now on.

    I've never figured a way to toggle this behavior back to how it was, but I've rarely ever needed to compare two builds side-by-side.