• Post Reply Bookmark Topic Watch Topic
  • New Topic

Task Manager  RSS feed

 
Divakar Sashwanth
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to list down all the Task that are currently running on my machine(In Task manager). I need to some how find the task names that are running. Can this be achieved in 1.4 ?. Should i have to use any external API for this ?...

Pls sugggest me or point me to some articles where i can get some help on these...

I will appreciate if someone can help me on this
[ August 16, 2006: Message edited by: K Divakar ]
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Java 1.4, you definitely need native code (C/C++) to do this. I presume you are using Windows, so go search MSDN. You can link your C++ code to your Java code using Java Native Interface.

Dunno if Java 5 or 6 helps any more in these areas.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there is an operating system command or utility that can do this you can exec() that command, capture the output, and parse it. For example, in windows XP you have the tasklist command.
Bill
 
Divakar Sashwanth
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i am really looking for a command that can list all the tasks that are running through the DOS command.

Is there any DOS Command that can list all tasks ?..

Thanks for your comments...
 
Steve Fahlbusch
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try

> tasklist

as Bill above provided
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is there any DOS Command that can list all tasks ?..

...other than the one William mentions? Which OS are you using?
[ August 16, 2006: Message edited by: Paul Sturrock ]
 
Divakar Sashwanth
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Let me say you the problem i am facing...
I have developed a desktop application. When i execute it, Only one instance of it must be executed. When the user tries to execute the same application(2nd Instance), it should say a warning...

So i was trying to get the tasklist that is running in my windows 2000/ Windows XP operating system and verify whether one instance if it is already running...

I tried using "tasklist" command in the windows XP system DOS Prompt[Command], I could not get any result.

Give me a suggestion to solve my problem.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suspect that a solution using "tasklist" would not work if the user has two copies o fthe application with diferent names.

One approach would be for the application to open a ServerSocket (on port 5000, say). If a second application is started, and tried to do the same, an exception would occur, because you can have only a single ServerSocket on a particular port. So the exception handler would then quit the application.
 
Divakar Sashwanth
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dittmer

I think that will work out for me.. I tried and it worked fine..

Thanks all for the quick response...

If some have any suggestions please let me know
 
Paul Clapham
Sheriff
Posts: 22713
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, my suggestion would be, next time post the actual problem you have in the first place. By my calculation it took 16 hours between the time you made the first post and the time you asked the real question. And then it only took half an hour before you got the real answer to the real question.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!