Java - allow only one application instance

Possible duplicates:
How to implement a single application Java application? How can I execute only one instance of my program?

What is a good and easy way to achieve this? I read port binding methods. Will this interfere with other applications using the same method?

+3
source share
4 answers

It’s not good to be attached to the port. Try to start the application and reset the network adapter, see what happens. Other applications may also use this port.

, , , : - , .

Apache JBoss? , .

+3

, . .

- . , , .

+1

, TCP, (/) . , , .

- ( ), . , , , , .

0

ServerSocket TCP/IP. , bind IOException.

This method will not interfere with other applications that use the same method unless another application opens the same port (TCP / IP ports are identified by a 16-bit number). Therefore, you should choose a fixed port number and hope that there are no other applications that accidentally use the same port number.

Note that on Windows you can use the command netstatto see which ports are used, with which executables.

0
source

Source: https://habr.com/ru/post/1761785/


All Articles