Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

detect

  Asked By: Richard    Date: Aug 30    Category: Java    Views: 631
  

Is there a way to detect if a program is allready running with java?
I want to run a program that does something when a certain program
stars so that the enviroment is correct for the other application.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Latasha Wilson     Answered On: Aug 30

perhaps RMI, or using lock files will be the answer for you. theres even
the posibility of having a socket server, so that when the program  runs
it contacts a server on a specific port, the server then announces that
a client is running  when all future connects are attempted.

 
Answer #2    Answered By: Ora Hanson     Answered On: Aug 30

Sorry, I am not clear what you asking but try these things.
Two things..
1st : open the task manager and go to process and see if java.exe is
running. if yes then some java program  is running.

2nd
Try to compile a very java program. ( Assume, you have j2sdk install )
do something like this
>javac HelloWorld.java ( Assume you have HelloWorld.java file )
Now, if ou get an execption then do

>set CLASSPATH=;%CLASSPATH%

This command basically set the environment varaible. But, when you
close the cmd window then this setting will go away. I would say set
these settings in Environment Variable so this way you do not need to
set this path everytime.

if you dont know how to install j2sdk then please send me a mail and i
will send you a link.

 
Answer #3    Answered By: Angel Watkins     Answered On: Aug 30

Sorry, I think I should be more clear on what I want. I want to rn a
java application  as a Windows NT service, which I know how to do. I
want this program  to look every 2 minutes if a certain program is
running eg blah.exe. If blah.exe is well running, it should perform a
specific task, like opening a window and telling the user that this
is a banned application on the network I help administrate. I only
want help with the detection of running  programs.

 
Didn't find what you were looking for? Find more on detect Or get search suggestion and latest updates.




Tagged: