hi i have changed a java process as the windows service. but in this whenever i am starting the windows service two java processes are running.it is spoiling my work totally can we have any way to remove a java process?
Or how did you start the process? If you use windows scheduler, you should be able to set for only one process running. If you manually start or use a script to run (not windows scheduler), stultuske would be the way to go (even though you catch all exceptions, you still have problem if there is a blackout or user turns off the computer without closing your program).
With a file, sooner or later it's inevitable that the program will terminate abnormally in some way, leaving the file in the wrong state.
You could open a ServerSocket (a concurrent second attempt will throw a BindException), which has the advantage that the port should be released whenever the JVM terminates, or the user is logged off, or the computer restarts.