Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Address already in use? Intellij

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?

like image 305
Gemasoft Avatar asked Feb 09 '23 06:02

Gemasoft


2 Answers

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.

Green Dot

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:

Single Instance Only Screenshot

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.

like image 67
Gemasoft Avatar answered Feb 11 '23 19:02

Gemasoft


Another option is Go to Run-->Edit Configuration --> Startup/Connection tab

Select Debug and change the port beside Debugger Settings..

like image 25
adithya Avatar answered Feb 11 '23 17:02

adithya