• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Task Manager

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try

> tasklist

as Bill above provided
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 27371
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic