• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

Error executing executable via Java Program

Experts,

I am trying to execute a PVCS command via a java program:

Process p = Runtime.getRuntime().exec("pcli Get [filename with parameters]");

When I execute it in the above statement, the dos window opens and just hangs and never executes. It looks like it just freezes. However, when I put the statement in a batch file and run it via the command prompt, it executes immediately.

Can you please explain why I am getting this error when I run it via a java program.
0
gvijay1
Asked:
gvijay1
  • 2
1 Solution
 
objectsCommented:
try:

Process p = Runtime.getRuntime().exec("cmd /c pcli Get [filename with parameters]");

and if that doesn't work try including the full path
0
 
CEHJCommented:
You need to handle and consume the process' streams on separate threads. See

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
0
 
gvijay1Author Commented:
YOU NAILED IT! Thanks a bunch.
0
 
CEHJCommented:
:-)
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now