🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Get program id from java

#7552
From: Russell
Date: Wed, 06 Jun 2001 06:04
48 lines
2930 bytes
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
Technical Details
Message-ID: <3B1DC7F9.5FC04312@cesmainternational.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!netnews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews
References: <3B1C5D8E.36A4A8C4@cesmainternational.com> <MPG.158654718aa35dbb98a262@forums.borland.com> <3B1C926F.8E6ADE24@cesmainternational.com> <MPG.15866f22a70b49a598a264@forums.borland.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-05 23:12:11 PST
Message-ID: <3B1DC7F9.5FC04312@cesmainternational.com>
Date: Wed, 06 Jun 2001 14:04:41 +0800
From: Russell <weetat@cesmainternational.com>
X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.13-0.13 i686)
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>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 203.126.155.39
X-Trace: dnews 991807506 203.126.155.39 (5 Jun 2001 23:05:06 -0700)
Lines: 48
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!netnews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews