Possible Duplicate:
How to implement a single instance Java application?
is there a way to run only one instance of Java application so only I have one process? . is it possible to do it in java?
A simple way to have one instance is to use a service port.
ServerSocket ss = new ServerSocket(MY_PORT);
The benefit of using this approach instead of a locking a file is that you communicate to the instance already running and even check it is working. e.g. if you can't start the server socket use a plain Socket to send it a message like "open a file for me"