views:

69

answers:

2

I am executing a bat file from java (batch file executes another java app) Now, how can i make sure that batch executed and triggered the another java app.

IS there any way to tell that another java app started successfully.

+1  A: 

I'd suggest running the other application directly from Java and then check the return code. Also, you could run the other application in its own controller thread from your first application.

Running one application via another batch file seems like an awkward design...

polemon
Beware return code of launched java apps under MS Windows is typically not going to give you an error indication.
jowierun
+1  A: 

Why using a batch file? For all practical purposes, this is counter productive while using a platform independent language! Java can do well better than what batch files can do, and also will protect your application by not exposing how you launch other processes while not being dependent of a batch file process successful state...

Anyway, take a look here at how to start external processes and monitoring outputs using ProcessBuilder.

Also, you can check out the API.

Yanick Rochon
Not everyone picks Java for its platform independence. Heck, you can argue the same with people who write platform-specific C. That part of your answer is pretty much unhelpful.
Joey