Getting exclusive system-wide lock in Java
Each time you start Java executable, you start a new instance of Java Virtual Machine (JVM). They are like a different workstations. That's why there is no such a thing like system mutex in Java.
You can use exclusive access to a File on the File System to achieve similar behavior. I don't think there is something similar to what you've mentioned.
Examples
- Java Programming [Archive] - open File in exclusive lock
- java.nio.channels.FileLock
Java is a least common denominator tool that provides functionality that is common to all platforms it runs on, that is if it has been implemented yet.
You could use JNA (A simplified way to access native functionality)
In the past I have used sockets to make sure that a program could not start if one was running.
As indicated elsewhere a File based Semaphore could work, of course a downside to this is if the program crashes then your semaphore has to be manually reset.