Sometimes when I try to run my project using maven mvn clean install jetty:run
it returns an error that says: "Address already in use".
I'm using Intellij IDEA 14.
Could you please help me to figure out what's happening?
This happens because every time the code is ran using the green arrow icon it generates a new instance and since the port (8080 in this case) is already in use it can't run again.
The first solution comes stopping the instance is currently in use, you can know if there is already an instance running at the bottom left corner tabs, if one of the tabs has a little green dot it means it is currently running.
One nice feature to avoid this is to go the run/debug configuration and set the option Single Instance Only at the top right corner as you can see here:
Now, you can run the project using only the green arrow/bug icons and it will stop it if it's already running, compile and then run again just with one click.
I found this very helpful to get rid of this silly error.
Another option is Go to Run-->Edit Configuration --> Startup/Connection tab
Select Debug and change the port beside Debugger Settings..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With