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

calling another program from Java Application

 
Rashmi Trivedi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I was wondering if i can do this. I have writteen one java application that converts data metric to imperial and wirte to another file. The program is working fine but what i would like to do is, once i write data back to the file i would like to call another program and end java applicatlion. OR i should say wake up another program to do the rest. The another program could in C++ or VB, i am not sure yet.
I think it is possible however i couldn't find much information on that topic. I would really appreciate if you guys can assist me in this matter.
Looking forward to hearing from you shortly.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might be able to use Runtime.exec(). But really this is a job for batch files (Win)/shell scripts (*nix). You can use the exit status to control program flow through the script.
- Peter
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime.getRuntime().exec("whatever.exe inputfile.txt"); //start the new process
System.exit(0); //end this process
 
Rashmi Trivedi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Peter and Cindy
Thank you for your assistance. I will try your suggestion and let you know how it goes.
Thank you once again.
Regards,
Rashmi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic