• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to interect between two JVM instances?

 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to all ranchers,

My desktop application is a JFrame and I want only one instance of my application to run at a time and so far i have been successful.

I used file locking mechanism to check if the lock on the file exists and it it does exists then I am stopping another instance of JFrame to load.

But when I minimize the first instance i want that first instance of JFrame to be maximized or you can say setVisible(true).

Does any one have any idea how can i do this?

Thanks
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of using a lock you could have them communicate using Sockets.
You can start the first one as a Server on a fixed port, and a second will not be able to start on that port until the first one dies. You can have these processes communicate via this port as well.
 
Yeah, but is it art? What do you think tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic