Java: How can I create an application that will only start if an instance of it doesn't exist and call the instance if it does exist?
问题 I am trying to create a program with Java that can only have one instance of it running at a time. I am using Sockets and ServerSockets to try to achieve this. How the program is supposed to work is: The main method will check if any parameters have been passed, it will try to write the first parameter to the server, if it fails that means, that means that this is the only running instance, so it will open the ServerSocket and then start the frame. If it doesn't fail then the application is