How to solve Address or Port already in use error in java? Address already in use: JVM Bind is one of the most popular error among java developers and guys who do socket error programming in some other language too. But with respect to java this error is much familiar with socket programming and during web development. This error happens for ports 80 (HTTP) , 1098 (RMI) when it is used by other applications that is running on the same PC or server. So I am going to explain how to debug and solve this problem.

Step I : Finding the ports that are in use:

1. You can use the tool CurrPorts to solve this problem. You can read about the tool in my previous post How to find open ports in your PC?

2. If you are using windows XP you can use the netstat command to view which processing is occupying the port. If you use Windows 2000 then you cannot use the netstat -o in your netstat command which tells you the process ID that is using the port. So in windows 2000 use the tool CurrPorts which is free.

eg) netstat -ano



If you have problem with port 1098 then check whether outlook or firefox is currently in use and close the same to free the port. This is just an example and for a better report you can use the tools mentioned above.

Step II : Free up the port:

You can free up the port by 3 ways,

1. If you use CurrPorts tool then you can find the application that is using it and you can close it down or kill the process by right clicking in the tool.

2. In windows you can use the command taskkill /PID 828 to kill the appropriate process.

3. Making your program to use a different port. For instance if you are encountering this error with JBOSS Application server for port 80, then you can go to server.xml in the appropriate directory say server/default/deploy/jbossweb-tomcatXX.sar/server.xml and change the port to 8080 to avoid the conflict. In case of Tomcat look for server.xml in the conf directory


Hope the above explanation helps. Feel free to comment.

  • Stefan G

    It was quite helpful having the netstats Windows XP utility
    pointed out, as it helped verify a problem I was having.

    Much appreciated.

  • Eli

    Solved my problem. Thanks!

  • Vaav

    I’m trying to start the jboss5.0 server but it shows” Server port In Use 1098-Http”. I’ve tried everything , tried different port numbers like 8080,8086,9083 etc. I downloaded currPorts but it doesnt show any of the mentioned ports in the list. I wonder then why i’m not able to use them for the Jboss server?. Can anyone guide me?