Optional single application instance enforcement and multiple startup notification

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srinivask
    New Member
    • Jan 2007
    • 7

    Optional single application instance enforcement and multiple startup notification

    kindly give java code

    how to run a single instance in java for exe application based on gui
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by srinivask
    kindly give java code

    how to run a single instance in java for exe application based on gui
    Can you be more specific? Do you want to know how to run a Java program?

    Comment

    • srinivask
      New Member
      • Jan 2007
      • 7

      #3
      Optional single application instance enforcement and multiple startup notification

      hello,


      iam working in java GUI Based program with Swings

      for eg: if i started yahoo messanger only single instance is going to be created

      if at all ur try ing to open new it will open existing window on the tool bar
      similarly i want to make my java exe to be single instance.

      so possibly send any java code if u have or send nice idea to do

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by srinivask
        hello,


        iam working in java GUI Based program with Swings

        for eg: if i started yahoo messanger only single instance is going to be created

        if at all ur try ing to open new it will open existing window on the tool bar
        similarly i want to make my java exe to be single instance.

        so possibly send any java code if u have or send nice idea to do
        How many frames do you have in your program? Are you saying you want only one frame to be opened at a time? Please post the codes you have and explain exactly how you want the program to behave, I still don't understand what you are talking about.

        Comment

        • srinivask
          New Member
          • Jan 2007
          • 7

          #5
          Originally posted by r035198x
          How many frames do you have in your program? Are you saying you want only one frame to be opened at a time? Please post the codes you have and explain exactly how you want the program to behave, I still don't understand what you are talking about.
          hello excuse me,
          i have only one frame, where my main method is going to be executed, in my program.and now i want it to be executed only once,if at all i want to open it again,it must be redirected to the same instance saying that the program is already running.
          example:yahoo messenger.
          hope u got it.give proper code related to it,its urgent.

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by srinivask
            hello excuse me,
            i have only one frame, where my main method is going to be executed, in my program.and now i want it to be executed only once,if at all i want to open it again,it must be redirected to the same instance saying that the program is already running.
            example:yahoo messenger.
            hope u got it.give proper code related to it,its urgent.
            How is this program going to be run?

            Comment

            • srinivask
              New Member
              • Jan 2007
              • 7

              #7
              Originally posted by r035198x
              How is this program going to be run?
              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.

              We r using netbeens ide to run the programs and how do u

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by srinivask
                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.

                We r using netbeens ide to run the programs and how do u
                If only you had explained like this first time.
                I'm not sure about this but if you make the program a thread and give it a name and then check against that thread before running the program

                Comment

                • srinivask
                  New Member
                  • Jan 2007
                  • 7

                  #9
                  Originally posted by r035198x
                  If only you had explained like this first time.
                  I'm not sure about this but if you make the program a thread and give it a name and then check against that thread before running the program
                  Hai,
                  U said to check the thread.But can u tell me how to find a thread which is in running state and probably OS which is handling.If we can get that then probabaly we can know before next instance has been created .Don't guess the answer just let me know if u really have answer to it.

                  Comment

                  • r035198x
                    MVP
                    • Sep 2006
                    • 13225

                    #10
                    Originally posted by srinivask
                    Hai,
                    U said to check the thread.But can u tell me how to find a thread which is in running state and probably OS which is handling.If we can get that then probabaly we can know before next instance has been created .Don't guess the answer just let me know if u really have answer to it.
                    No problem. You can check for yourself here if you think I might make a mistake. Why do you want to know the OS as well?

                    Comment

                    • srinivask
                      New Member
                      • Jan 2007
                      • 7

                      #11
                      Originally posted by r035198x
                      No problem. You can check for yourself here if you think I might make a mistake. Why do you want to know the OS as well?
                      you have given link to thread class but it is of no use for me.

                      MY question is suppose One.java is file which have a thread in it By name "DemoThread ' (name of thread) .when i compile and run One.java my DemoThread is going to run aswell. Now if i try to create again new instance of same class ie One.java at that particular time how can my One.java file know that already DemoThread is running as i did not stopped my first instance.

                      prob this might have made u little bit clear.

                      Comment

                      • r035198x
                        MVP
                        • Sep 2006
                        • 13225

                        #12
                        Originally posted by srinivask
                        you have given link to thread class but it is of no use for me.

                        MY question is suppose One.java is file which have a thread in it By name "DemoThread ' (name of thread) .when i compile and run One.java my DemoThread is going to run aswell. Now if i try to create again new instance of same class ie One.java at that particular time how can my One.java file know that already DemoThread is running as i did not stopped my first instance.

                        prob this might have made u little bit clear.
                        Perhaps you've never used threads before then.
                        Here is another method which should be easy for you to grasp.
                        Use the System class.
                        When the instance is created check to see if a property is set using the getProperty method. If not, set a property, give it a key and continue with the instantiation otherwise the program is already running so exit.

                        Comment

                        • olakara
                          New Member
                          • Nov 2006
                          • 18

                          #13
                          Originally posted by srinivask
                          kindly give java code

                          how to run a single instance in java for exe application based on gui
                          Why do you want to run only one instance?
                          -- Abdel Olakara

                          Comment

                          • r035198x
                            MVP
                            • Sep 2006
                            • 13225

                            #14
                            Originally posted by olakara
                            Why do you want to run only one instance?
                            -- Abdel Olakara
                            http://olakara.googlep ages.com
                            Hi Abdel.

                            The OP made another post for the same problem. I'll merge the posts.

                            Comment

                            • kumar888
                              New Member
                              • Nov 2007
                              • 1

                              #15
                              Did you got the code for this problem.If yes can you please send me that code to me.It's urgent.
                              Thank you...

                              Originally posted by srinivask
                              kindly give java code

                              how to run a single instance in java for exe application based on gui

                              Comment

                              Working...