thanks,<br />Gayathri
Originally posted by Vijay Vaddem:
I heard eclipse does something similar to this....
But how??
U mean to say that i should create a file and save it on local system
and check it everytime??
thanks,<br />Gayathri
Originally posted by Vijay Vaddem:
I have a stand alone application built on swings and jdbc..
Now, when the user runs the main program...it gets instantiated fine
and runs ok.
Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
SCJP 1.4 91%, SCJP 1.5 88%, SCJD B&S
Vijay, if you program is using a database, you can use that to flag the state of the number of instances of your class... Database access would be a bit overhead than using normal text file. However, its advantage is that the security provided by the database would prevent outside disturbance to unprotected normal text file...
SCJP 1.4 91%, SCJP 1.5 88%, SCJD B&S
Originally posted by Jared Cope:
Hi,
In response to my post about just looking for the list of running programs, I did this for a program written in Centura with the help of a windows dll file (user32.dll).
If you wanted to, you could try linking your java program to native code in user32.dll and try running that function. You might need to do some investigating to see what function it is.
I have not tried, but java can run native code. This of course assumes that you are running your java on windows.
If this does not work, I would stay away from using a database to manage the number of instances and go for the lock.txt file option described.
Best of luck, Jared.
SCJP 1.4 91%, SCJP 1.5 88%, SCJD B&S
The nice thing about Standards is that there are so many to choose from!
I've solved this problem in the past by looking at the names of programs currently running on the computer as one of the first startup tasks. If the name already exists, then I quit the application with a message to the effect: "You are already running program X. Only one instance is allowed."
I admit that I have not done this with the Java language, but I would be very surprised if this is not possible.
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|