🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7564

Re: Get program id from java

#7564
From: Nabin Thomas
Date: Thu, 07 Jun 2001 16:35
72 lines
3731 bytes
You can capture the output of the Process ( that is pid program of linux) by
the method
Process.getInputStream()
and can parse the output to get the process ID

Russell wrote:

> Hi John , Thanks for your advices and information.
>
>   BTW , i can get the PID from Process....from Linux Process.My question
> is ...
>
>   Can i get PID value and from PID , minimize the window or close window
> where the process is running ??
>
>  Thanks.
>
> "John McGrath [TeamB]" wrote:
> >
> > On Tue, 05 Jun 2001 16:03:59 +0800, Russell wrote:
> >
> > > I can see PID for a process , but how i am going to get PID
> > > value??? I try to read value without any successful ,belows
> > > is the code.
> >
> > There are techniques that you can use to get at just about anything in
> > Java, but be aware that doing this would depend on the implementation,
> > which could change.  The class of the Process object that you saw was
> > actually a subclass of Process, since process is abstract.  It may be
> > that a future version of the Java platform you are using will change
> > that class, or return an entirely different subclass of Process.  It is
> > even possible that the current implementation of Runtime exec() may
> > return a different subclass of Process depending on some unknown
> > factors.
> >
> > In other words, you would be giving up the assurances of portability
> > that you currently have if you delve into the innards of code that is
> > implementation dependant.  If you do that sort of thing, you should
> > write *very* defensive code, and plan for the contingency that it will
> > fail.
> >
> > That said, if you are *sure* that you want to do this sort of thing,
> > you should be able to use the Reflection API to get at the PID field.
> > If the field is not normally accessible, it is possible to override
> > the accessibility using the setAccessible() method.
> >
> > --
> > Regards,
> >
> > John McGrath [TeamB]
> >
> > ---------------------------------------------------
> > Before sending me e-mail, please read:
> >     http://www.JPMcGrath.net/newsgroups/e-mail.html

--
        ***********************************
***************************************************
******************* Web Card **********************
***************************************************

Name :   Nabin Thomas

e-mail :   nabinthomas@hotmail.com

Web :   http://nabin.topcities.com

Feel free to contact me thru e-mail or MSN Mssenger
if required but DONOT SPAM

***************************************************
 ***********************************
Technical Details
Message-ID: <3B1FAD54.B535871@hotmail.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.algonet.se!algonet!newsfeed1.bredband.com!bredband!uio.no!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews
References: <3B1C5D8E.36A4A8C4@cesmainternational.com> <MPG.158654718aa35dbb98a262@forums.borland.com> <3B1C926F.8E6ADE24@cesmainternational.com> <MPG.15866f22a70b49a598a264@forums.borland.com> <3B1DC7F9.5FC04312@cesmainternational.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,12a44754146f6396
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-07 10:13:03 PST
Message-ID: <3B1FAD54.B535871@hotmail.com>
Date: Thu, 07 Jun 2001 22:05:32 +0530
From: Nabin Thomas <nabinthomas@hotmail.com>
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Get program id from java
References: <3B1C5D8E.36A4A8C4@cesmainternational.com> <MPG.158654718aa35dbb98a262@forums.borland.com> <3B1C926F.8E6ADE24@cesmainternational.com> <MPG.15866f22a70b49a598a264@forums.borland.com> <3B1DC7F9.5FC04312@cesmainternational.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 202.9.186.21
X-Trace: dnews 991932566 202.9.186.21 (7 Jun 2001 09:49:26 -0700)
Lines: 75
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.algonet.se!algonet!newsfeed1.bredband.com!bredband!uio.no!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews