Thursday 15 January 2015

swing - Single instance of application per user in Java -


I created an application in the swing and I want to run it only one example. I have written something like this:

  Private static last full port = 12345; {Try (new server socket (port, 10, initadder.gateholkhost ());} should not be for hold (UnknownHostException e) {// localhost} (IOE EXPRESS e) {// taken the port, so the app is already System.out.println ("application already exists") is running; System.exit (0);}}  

This works but only for all systems. If a user runs it, then the other can not use it at the same time. Users can only run one instance of this app. Do you know how I can do this?

< P> For each user, the port number as priority will be associated with the priority user account. The first time a user runs the application, the preference does not exist - randomly generates a port number and that user After that, every time a user starts the application, read its port priority

Since each user will use a different port, each user example will use each other Will not interfere with - but each user will be limited to an example.


No comments:

Post a Comment