Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8058415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:21:05+00:00 2026-06-05T09:21:05+00:00

I am executing a process using the Process class. Going through the error stream

  • 0

I am executing a process using the Process class. Going through the error stream seems to be necessary to execute the process successfully. Why is going through the error stream necessary for the process to run correctly? Is there something I am doing wrong?

Process wkstdin = Runtime.getRuntime().exec(command);
BufferedWriter wkstdin_writer = new BufferedWriter(
            new OutputStreamWriter(wkstdin.getOutputStream()));
//write data

Necessary Part of the Code:

BufferedReader input = new BufferedReader(new InputStreamReader(
            wkstdin.getErrorStream()));
String ch;
while ((ch = input.readLine()) != null)
{
  System.out.println(ch);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:21:07+00:00Added an answer on June 5, 2026 at 9:21 am

    When the process writes to stderr the output goes to a fixed-size buffer. If the buffer fills up then the process blocks until there is room for the remaining output in the buffer. So if the buffer doesn’t empty then the process will hang.

    Also if something goes wrong with the process you’d like to know about it, the error stream may contain actual useful information.

    Some suggestions:

    • Naming a String ch seems misleading, since ch is usually used for chars.
    • I like to put the code that reads from stderr in a dedicated worker thread. That way switching between reading the input stream and the error stream happens automatically without my having to allow for it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to execute a batch file using the Process class. This code
I am trying to execute a batch file from C# code using Process class.
I've run into some problems debugging a multi-threaded process using GDB. I have a
I have a C# class, MyCommand, that is run using a backgroundWorker and thread
i am using cruise control to automate the svn commit process. but the execution
I have a problem executing a process from our testing server. On my localhost
Our Continuous Integration process appears to be executing programs that are in contention for
I'm executing this code: void update_process(PROCSP * process){ int state; printf(process.pid = %d\n, process->pid);
I am in the process of creating a new team project by executing the
Will the following program cause any problem during compiling and execution process? class A{

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.