How to kill Java process on mac OS Sierra using Activity Monitor

Using Activity Monitor to kill Java Process on mac OS

Last week I wrote an article on the improvements in Spring Boot 1.4 of startup errors. Specifically, we saw that we got a really informative error message when we try and run an application and port 8080 is already in use. 

I received a question from a reader that went like this 

“I get the port 8080 is already in use error from time to time and I am not sure how to fix it, what can I do?” 

This is actually pretty easy to fix and happens to all of us. In this short article, I will show you how to do it on macOS and link to another article I wrote on how to do this on Windows. 

Port 8080 is already in use

This problem usually comes up because another process wasn’t properly terminated. If you want to simulate this issue you can fire up one app in a terminal and then try launching another in your favorite IDE (IntelliJ right?). I opened up a terminal and ran my other project using the Maven plugin.

Spring Boot Maven Plugin

Now if we head into IntelliJ and try to run our application we are going to see an error that looks something like this. 

Port 8080 is already in use

Activity Monitor FTW

So we know that another process is running but it isn’t always as simple as forgetting a terminal window is open and running another app. This can happen when an IDE is closed and the process is correctly terminated. 

macOS gives us a nice tool for monitoring process by name and port called Activity Monitor. If you open up Activity Monitor (I just use Spotlight) you could manually look for the processes or use the search bar in the upper right-hand corner. Now you can kill the existing processes and your unwanted process will be gone.

Activity Monitor

What about Windows? 

If you’re a windows user I wrote an article awhile back on how to kill a process by port number. 

Screencast

Conclusion

test

Hi, I’m Dan Vega. I am a Software Engineer living just outside of one of my favorite places in the world, Cleveland, Ohio. I am a self-taught programmer who firmly believes that you can accomplish anything in this life if you put your mind to it, roll up your sleeves and are willing to put in the work.

I have been writing software for over 18+ years now and I use my knowledge, passion, and influence to help other developers achieve their goals. I teach online and currently, have over 30,000 students.

When I am not writing software, I have a number of things that really keep me busy. I love to read books, listen to podcasts and watch online courses. I have a real thirst for knowledge and it consumes me every single day of the week. I also love to run & lift heavy weights which keep me balanced throughout the week.

Please note: I reserve the right to delete comments that are offensive or off-topic.