Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts

Thursday, January 12, 2012

How to kill Apache Tomcat without restart your computer

Are you using Eclipse to start/stop you Apache Tomcat? If Yes, have you encountered error regarding the required ports already been used and you are sure there is no other Tomcat running on the same machine.

This problem happens in my working environment very often. I am not sure what causing the tomcat stop improperly and failed to restart.

I try to kill the java process using ProcessExplorer but failed. The process still running no matter how many time I kill it.

If your run netstat in cmd you will see the port 8080 under the states of CLOSE_WAIT. Mean the connection is close from 1 end and the other end is waiting.

I have found 2 solutions

  1. Restart you machine
  2. Close the connection

You can restart you machine then the connection will close automatically. Else use 3rd party program to close the connection. I am using CurrPorts, you can download from http://www.nirsoft.net/utils/cports.html .

Just search for java process and right click “Close Selected TCP Connections”.

Hope this will help someone in the future.



Tuesday, September 27, 2011

How to create large dummy file in Windows Command-Line

Sometime you might need to create a dummy file for testing or other purpose. How can you create a file with the file size you want? For example, how can you create a 1GB file for your testing?

Windows have a command line utility called Fsutil that can help you to create the respective file size you want.

The following command create a dummy file called “test.txt” with 1 GB file size. Just copy and paste into your cmd.

fsutil file createnew test.txt 1000000000