You can use JUnique library. It provides support for running single-instance java application and is open-source. It's based on file locks, but use also random port to send/receive messages from other running java instances.
http://www.sauronsoftware.it/projects/junique/
See also my full answer at How to implement a single instance Java application?