Running single Instance of java application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msatya
    New Member
    • Sep 2006
    • 2

    Running single Instance of java application

    Hi,

    I developed a swing based application in java. I am running it through the executable jar. Each time clicking on the jar file it opens the new instance of the appliction.

    But I want to open the single instance of the application i.e. If the application is running , then user tries to open another instance it should be display the error or running application only like yahoomessenger, notepad,etc.

    Please tell me how it is done in java. send aly sample code or resources regarding this.

    Thanks
    in advance
  • PLA
    New Member
    • Aug 2006
    • 44

    #2
    Originally posted by msatya
    Hi,

    I developed a swing based application in java. I am running it through the executable jar. Each time clicking on the jar file it opens the new instance of the appliction.

    But I want to open the single instance of the application i.e. If the application is running , then user tries to open another instance it should be display the error or running application only like yahoomessenger, notepad,etc.

    Please tell me how it is done in java. send aly sample code or resources regarding this.

    Thanks
    in advance
    You can use a file as a flag: When you start test the existence of the file, if not create it and start your app, whe your app is finish, delete the file. Sorry no sample code.

    Comment

    Working...