• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can we Identify which java process?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Suppose we are running two java (say swing appln) applications on a windows machine. In that case we can see two java processes running in windows task manager.
Can we identify which java process is running for which application?
Thanks in advance.
 
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
There is no easy way to do this. If you want to know if one particular Java application is running you could use a marker when it starts up: possibly have it create a lock file or open a connection to a port.

Depending on the version of Windows you are using you might be able to use Windows Scripting Host's Shell object to start your Java app. from a WSF and get the PID. I've never tried it, but it theoretically should be possible. Of course it will mean you need to write two programs rather than one...
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure why you want to do this but you can take the help of a profiler if your need is to increase the performance of a program by checking the consumption of system resources. Profiler is a computer program that can track the performance of another program by checking information�s collected while the code is executed. A profiler can identify the time used by or frequency of use of various portions of the second program. Typically this information is used to identify those portions of the second program that consume the most time. These time consuming parts are then targeted for optimisation. Also a profiler can be useful for debugging.

--------------
Naveen Vooka
www.devsquare.com
DevSquare - Online Application Development
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the processes have different command lines, then it is possible.
Task Manager can't display full command line, but Sysinternals Process Explorer (enhanced task manager) or other similar program can.
[ September 27, 2005: Message edited by: Vlado Zajac ]
 
Paul Sturrock
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
Except looking in the process explorer for a distinct "cmd.exe" has the same problem as looking for a distinct "java.exe". You still don't know which process is which.
 
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java 5.0 has a platform independent ps command: e.g., jps -l

That will show you which jvm is running which main class.

(jps is in the bin folder with java and javac so you can execute it directly)
[ September 28, 2005: Message edited by: Rick O'Shay ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic