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.
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.
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.
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
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
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.
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?
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.
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