🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Get program id from java

#7537
From: Russell
Date: Tue, 05 Jun 2001 08:03
46 lines
2360 bytes
Hi John , 

  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.


    Process p = Runtime.getRuntime().exec("/usr/bin/netscape");
    BufferedReader br = new BufferedReader(new
InputStreamReader(p.getInputStream()));
    String s = br.readLine();
        while(s != null){
         System.out.println("s : " + s);
         s = br.readLine();
         }
        }

  Any ideas ??

Thanks

  

"John McGrath [TeamB]" wrote:
> 
> On Tue, 05 Jun 2001 12:18:22 +0800, Russell wrote:
> 
> > Is there any ways to get the program id ??
> 
> There is no portable way to get the process id for a process you have
> created in Java.  This is because there is no guarantee that the host
> operating system even has a concept like a process id.
> 
> I suspect that it would be possible to get at the PID for a process,
> but the method would be very much platform dependant.  If you want to
> do that, use JBuilder's debugger to look at the Process object that is
> returned by the Runtime exec() method.  I am guessing you will find the
> PID in there.
> 
> --
> Regards,
> 
> John McGrath [TeamB]
> 
> ---------------------------------------------------
> Before sending me e-mail, please read:
>     http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <3B1C926F.8E6ADE24@cesmainternational.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!t-online.de!skynet.be!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews
References: <3B1C5D8E.36A4A8C4@cesmainternational.com> <MPG.158654718aa35dbb98a262@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 01:12:58 PST
Message-ID: <3B1C926F.8E6ADE24@cesmainternational.com>
Date: Tue, 05 Jun 2001 16:03:59 +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>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 203.126.155.39
X-Trace: dnews 991728263 203.126.155.39 (5 Jun 2001 01:04:23 -0700)
Lines: 46
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!t-online.de!skynet.be!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews