Thread View: borland.public.jbuilder.java.api
4 messages
4 total messages
Started by Eric Orilla
Wed, 23 Feb 2005 09:01
Single Instance Application
Author: Eric Orilla
Date: Wed, 23 Feb 2005 09:01
Date: Wed, 23 Feb 2005 09:01
4 lines
821 bytes
821 bytes
How to implement a single instance application? Thank you!
Re: Single Instance Application
Author: Kevin Dean [TeamB]
Date: Wed, 23 Feb 2005 13:14
Date: Wed, 23 Feb 2005 13:14
26 lines
1905 bytes
1905 bytes
Eric Orilla wrote: > > How to implement a single instance application? > I don't think that's possible in Java. You need access to operating-system specific calls to get to the task list and switch to your currently-running instance. If you're running under UNIX, a shell script that starts your application will do the job quite nicely. Under Windows, there's no easy way I can think of. -- Kevin Dean [TeamB] Dolphin Data Development Ltd. http://www.datadevelopment.com/ NEW WHITEPAPERS Team Development with JBuilder and Borland Enterprise Server Securing Borland Enterprise Server http://www.datadevelopment.com/papers/index.html Please see Borland's newsgroup guidelines at http://info.borland.com/newsgroups/guide.html
Re: Single Instance Application
Author: Paul Nichols (TeamB)
Date: Wed, 23 Feb 2005 14:59
Date: Wed, 23 Feb 2005 14:59
29 lines
2249 bytes
2249 bytes
"Eric Orilla" <eorilla@hotmail.com> wrote in message news:421c464c$1@newsgroups.borland.com... > Here's how I would do it to ensure XPlatform. When the application starts, read from a configuration file (XML, Properties file, whatever you wish). Look for a runtime value (call it AppRunning, Running, IsRunning, etc). If the value of the param is true, create a message starting that the application is currently running. You might want to add an override feature just in case the application/OS locked up or crashed. If, on startup, the value is null, false, etc. set the parameter/entity to true, once the application has launched. This would ensure that only one instance is running. Other than this, as Kevin stated, there is no other way to do this and ensure XPlatform. If that is not important to you, and let's say you need to support Windows and not MAC or Unix, then you will need to call a Windows API. Here is some information on creating a single instance app using C++Builder. You could create this app and use it to run your Java application, or use JNI in the program and in your Java code. However, if you use this as a wrapper for your Java code, you will have to ensure that the jar file is not runnable and you will need to create a custom class loader mechanism. Hope this helps ya!!
Re: Single Instance Application
Author: Lori M Olson [TeamB]
Date: Wed, 23 Feb 2005 15:18
Date: Wed, 23 Feb 2005 15:18
34 lines
2169 bytes
2169 bytes
Eric Orilla wrote:
> How to implement a single instance application?
>
> Thank you!
JBuilder does this. It opens a socket on a particular port (8888). If
another instance attempts to starts and detects this port is open, I
believe it just does an RMI call to force the running instance to the
front, and then ends.
I'm sure if you do some web searches along those lines you can find more
information. I'd also look into the Java Desktop site
(http://community.java.net/javadesktop/), look into the JDIC project
there, and ask some questions in their forum.
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads