the right way to kill a java thread on Windows?



I used NetBeans + JDK 1.5.2 to write a simple program using the SocketServer
class, on my Windows 2000 pc. The program dies not die when I kill it. I
kill it by right-clicking on the process in the execution window and
selecting "terminate." It appears to die within NetBeans but when I start
it, the SocketServer instance complains that the port is not available. The
Windows command "netstat -a" confirms that there is still a process
listening at the port, and Windows Task Manager also shows a java.exe
process running. If I kill that java.exe process from the Task Manager, then
everything is ok again -- I can restart my program and listen on the port
again.

What is the right way to kill a program like mine, so that it releases the
port?

Thanks,

John
(remove the pachyderm to reply)


.



Relevant Pages

  • Re: Rename a large file
    ... Windows Explore hangs and I have to go into ... the Task Manager to Kill it. ...
    (microsoft.public.windowsxp.general)
  • Process doesnt die
    ... terminate the process with the Task Manager. ... I cannot rebuild the program without the executable completing. ... process in windows other than the task manager? ... In Unix you would kill ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Rename a large file
    ... Windows Explore hangs and I have to go into the Task Manager to Kill it. ...
    (microsoft.public.windowsxp.general)
  • Re: the right way to kill a java thread on Windows?
    ... on my Windows 2000 pc. ... The program dies not die when I kill it. ... the SocketServer instance complains that the port is not available. ...
    (comp.lang.java.programmer)
  • Task Manager
    ... certain .exe's from the task manager, ... certain .exe's were found and terminated from the windows ... I want the kill function of the .exe's from the task ...
    (microsoft.public.vb.winapi)