Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

Check for a Windows Program

Thread view: 
m - 30 Jan 2007 19:41 GMT
Hi All

I have a C++ windows application.

I invoke this C++ app from my java program like this
Runtime.getRuntime().exec("cmd /c p:\\bin\\invokecpp.bat");

Is there a way I can check if my C++ program is up and running from my
java program which invoked it.

Please let me know.

Thanks
Andrew Thompson - 30 Jan 2007 20:30 GMT
...
> Is there a way I can check if my C++ program is up and running from my
> java program which invoked it.

Is that a question?

> Please let me know.

Please RTFM.

Look at what Runtime.exec() method returns,
then examine the methods of the returned
object.

Andrew T.
Ike - 30 Jan 2007 20:46 GMT
Try ctl-alt-del, check under the "processes tab." If it is running, you will
see it there. -Ike
Alex Hunsley - 01 Feb 2007 13:11 GMT
> Hi All
>
> I have a C++ windows application.
>
> I invoke this C++ app from my java program like this
> Runtime.getRuntime().exec("cmd /c p:\\bin\\invokecpp.bat");

 > Is there a way I can check if my C++ program is up and running from my
> java program which invoked it.
>
> Please let me know.

Please try asking a question if you expect an answer.

http://en.wikipedia.org/wiki/Question_mark
Luc The Perverse - 01 Feb 2007 19:29 GMT
>> Hi All
>>
[quoted text clipped - 11 lines]
>
> http://en.wikipedia.org/wiki/Question_mark

I am all about proper posting techniques . . but I think you are being a
little bit too nit picky with this one.

--
LTP

:)
www - 01 Feb 2007 13:32 GMT
> Hi All
>
[quoted text clipped - 9 lines]
>
> Thanks

I guess you want to check if your C++ program has finished or not. You
want to wait until it terminated, then proceed to execute your next Java
code, right ?

Process pr = Runtime.getRuntime().exec("cmd /c p:\\bin\\invokecpp.bat");
 //executing the script takes almost no time, but the C++ program
evoked by the script takes some time

pr.waifFor();   //this orders the machine to wait until your C++ program
or any subprocess evoked in last command to finish

System.out.println(pr.exitValue());  //it should print 0 now, which
means your C++ has ended normally


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.