The Artima Developer Community
Sponsored Link

Java Answers Forum
Get the processid of already running application

2 replies on 1 page. Most recent reply: Apr 24, 2002 12:33 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Keyur Patel

Posts: 1
Nickname: keyur
Registered: Apr, 2002

Get the processid of already running application Posted: Apr 24, 2002 5:39 AM
Reply to this message Reply
Advertisement
Getme some examples.


Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: Get the processid of already running application Posted: Apr 24, 2002 6:13 AM
Reply to this message Reply
You need to know the plateform !

In windows, I would not have a single idea.
On Linux, you can usually get a perfect-id of exctaly what is going on based upon reading the content of the /proc directory

Look for plateform specific solutions...


Thomas,
SCJP, Brussels

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Get the processid of already running application Posted: Apr 24, 2002 12:33 PM
Reply to this message Reply
On Windows, you use these API calls: CreateToolhelp32Snapshot(), Process32First(), Process32Next().

You could make a single JNI call that uses all three to put together a process list and return it, or you could create three analogous native methods.

Of course, you need to be more specific about what data you want in the list and what you intend to do with it. For instance, if you intend to do some manipulation or monitoring of processes, they you will need their process IDs (and probably more native methods for the other things you intend to do). If all you want to do is display a list of names, or see if a particular process is running, then you don't need so much detail (in fact, you could have a very simple native method called isProcessRunning() or something like that).

Flat View: This topic has 2 replies on 1 page
Topic: Help!  Creating a user-customizable GUI Previous Topic   Next Topic Topic: Erros in Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use