The simplest thing to do is to have your program try to open a socket - if it suceeds, its the only copy running. See java.net.ServerSocket.
This is not really a
servlet question - if I find you have asked this question in a bunch of other forums I shall be very annoyed.
Bill