Article View: borland.public.jbuilder.java.language
Article #7262Re: ?? Prevent starting a Programm twice???
From: Kevin Dwan
Date: Thu, 28 Jun 2001 18:39
Date: Thu, 28 Jun 2001 18:39
62 lines
3041 bytes
3041 bytes
"Joi Ellis [TeamB]" wrote:
> Petar Banicevic <petar_b@usa.net> wrote:
> > Can you tell me please how to do that ?
> > How to retreive a list of processes ?
>
> This is platform-specific, and the only way I know of to do it is to
> either write JNI code, or use Runtime.exec() to call a local command to find
> out.
>
> I'd stick with opening a ServerSocket. That's native java and should work
> everywhere.
>
> > "dnoyeB" <lamont_gilbert @ rigidsoftware.com> wrote in message
> > news:3b39da80$1_1@dnews...
> >> You can alternately check the running processes for a processes that
> > carries
> >> your name.
> >>
> >>
> >>
> >>
> >> "Joi Ellis [TeamB]" <joi@aravox.com> wrote in message
> >> news:3b39d418_1@dnews...
> >> > Peter Lustig <kschnepp@web.de> wrote:
> >> >
> >> > > I am searching for an easy way to prevent starting the same Programm
> >> manifold on a Computer.
> >> >
> >> > Have the program open a ServerSocket on a specific port. If it is able
> > to
> >> > open the port, then it's the only instance of the program running.
> >> > If it can't open the socket, either there are multiple copies of the
> >> program
> >> > running, or something else is using the port. You can make the port
> > user
> >> > configurable if you need to, as long as the program writes the new port
> >> number
> >> > someplace permanent
> >> >
> >> >
> >> > --
> >> > Joi Ellis (TeamB) http://www.teamb.com/
> >> > No direct email, please.
> >> > For best results, post on news server newsgroups.borland.com!
> >> > Newsgroup Info: http://www.borland.com/newsgroups/guide.html
> >>
> >>
>
> --
> Joi Ellis (TeamB) http://www.teamb.com/
> No direct email, please.
> For best results, post on news server newsgroups.borland.com!
> Newsgroup Info: http://www.borland.com/newsgroups/guide.html
I don't know if this is useful, but a search for "singleton" at JGuru turned up
http://www.jguru.com/faq/view.jsp?EID=124425
and other articles that might be informative.
Technical Details
Message-ID:
<3B3B79C5.69169590@blueberry.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3b398972$1_1@dnews> <3b39d418_1@dnews> <3b39da80$1_1@dnews> <3b3a1f7a_1@dnews> <3b3a691c_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,5fc10420f14b88fa X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-28 11:30:36 PST Message-ID: <3B3B79C5.69169590@blueberry.com> Date: Thu, 28 Jun 2001 11:39:01 -0700 From: Kevin Dwan <kevin@blueberry.com> X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: ?? Prevent starting a Programm twice??? References: <3b398972$1_1@dnews> <3b39d418_1@dnews> <3b39da80$1_1@dnews> <3b3a1f7a_1@dnews> <3b3a691c_1@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 209.204.172.41 X-Trace: dnews 993752826 209.204.172.41 (28 Jun 2001 11:27:06 -0700) Lines: 64 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews