• 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
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Java Detect another Program run?

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Greetings everyone!

I never experienced as .net developers
neither also as c++ or C# thus I hack a lack knowledge of this topic.

But i'm still curious mode right now, and I'm still looking around.

How could java detect another program is currently running?
Let's assume this windows environment instead of linux.

My question asking it is that because,
I dunno how to differenciate between one and another frame (running program)
that currently run.

Someone say, ID? I really dunno, what's that. ID of each frame?
is that really exist instead of the memory address of each program?
But memory address is too general and hard to detect,
which in turns different pc has different memory address pointing to that program which is
currently running.


~ Hope there's a guidance.

 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By another program what exactly do you mean? Instance of the same application or some other application?
 
Marshal
Posts: 21841
1456
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"jaya inside", please check your private messages regarding an important administrative matter
 
Ranch Hand
Posts: 58
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could run an external program from your Java code that can do the checking for you.
For e.g. your Java code can call the "ps" command on Unix or "tasklist" on Windows to check if an external program/process is running.
 
Sheriff
Posts: 22907
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But you can't use that with Java programs since all JVM processes are called "java.exe".
 
Suhrid Karthik
Ranch Hand
Posts: 58
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Match against the full command line arguments to "java" to resolve ambiguities.
 
Rob Spoor
Sheriff
Posts: 22907
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if that's possible in Windows. I've done a bit of process programming in Windows itself, using PROCESSENTRY32, and the parameters are not part of that structure.
 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Suhrid Karthik wrote:You could run an external program from your Java code that can do the checking for you.
For e.g. your Java code can call the "ps" command on Unix or "tasklist" on Windows to check if an external program/process is running.


well sure, it's the alternative way out perhaps. I'm also thinking that way now...
But, it would be caught upon the UAC User Account Cridential... such as pop up asking permission under
latest windows... omg.

but anyway, Robprime gave us something else

I'm not sure if that's possible in Windows. I've done a bit of process programming in Windows itself, using PROCESSENTRY32, and the parameters are not part of that structure.



what's that?
 
Rob Spoor
Sheriff
Posts: 22907
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a native struct which can be used in JNI.
 
reply
    Bookmark Topic Watch Topic
  • New Topic