Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Detect another Program run?

 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • 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.

 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By another program what exactly do you mean? Instance of the same application or some other application?
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4313
233
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jaya inside", please check your private messages regarding an important administrative matter
 
Suhrid Karthik
Ranch Hand
Posts: 58
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Match against the full command line arguments to "java" to resolve ambiguities.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a native struct which can be used in JNI.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic