Error executing executable via Java Program

Posted on 2006-05-22
Last Modified: 2006-11-18

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.
Question by:gvijay1
    LVL 92

    Expert Comment


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

    and if that doesn't work try including the full path
    LVL 86

    Accepted Solution

    You need to handle and consume the process' streams on separate threads. See

    Author Comment

    YOU NAILED IT! Thanks a bunch.
    LVL 86

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    Exchange and Third Party application. 8 45
    maxMirror challenge 10 68
    hash value 2 29
    json example 39 76
    For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now