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 7368179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:37:57+00:00 2026-05-29T03:37:57+00:00

So what i am doing is calling java.exe and making a call to a

  • 0

So what i am doing is calling java.exe and making a call to a jar file with some arguments. If everyting is fine and the command works, then the arguments are printed out to a richtext box.

The issue I am having is when the command isn’t correct. So in once instance, say the user types in the wrong password that’s passed into txtPassword. Stanadard out is not being redirected. If i run the exact same command in a Dos console, the message “Error: Auth fail”, is being presented. How do i redirect that error to the rich text box? I thought redirecting stdout would do it, but apparently not.

Any help would be apprecaited. Please see the code below.

  //Declare and instantiate a new process component.
                System.Diagnostics.Process process1;
                process1 = new System.Diagnostics.Process();
                process1.StartInfo.UseShellExecute = false;
                process1.StartInfo.RedirectStandardOutput = true;
                process1.StartInfo.CreateNoWindow = true;

                process1.StartInfo.FileName = "java.exe ";

                toLoad = lstBarToLoad.Items[i].Text;

               process1.StartInfo.Arguments = "-Xmx512M -jar Deploy.jar" + txtPassword;
               process1.StartInfo.Arguments += toLoad;

              Console.WriteLine(process1.StartInfo.Arguments);

              process1.Start();
              process1.OutputDataReceived += (s, a) => myMethod(a);
              process1.BeginOutputReadLine();

   //myMthod
     private void myMethod(DataReceivedEventArgs e)
    {
         if (e.Data != null)
        {
            Action action = () => rchsdtOut.Text += "\r\n" + e.Data.ToString();
            rchsdtOut.BeginInvoke(action, null);
            Console.WriteLine(e.Data.ToString());
        }
    }//end of private
  • 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-05-29T03:37:58+00:00Added an answer on May 29, 2026 at 3:37 am

    As well as using

    process1.StartInfo.RedirectStandardOutput = true;
    

    You also need to use

    process1.StartInfo.RedirectStandardError = true;
    

    Gets or sets a value that indicates whether the error output of an application is written to the Process.StandardError stream

    http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandarderror.aspx

    You can then read out the error and do with it as you please:

    string error = process1.StandardError.ReadToEnd();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to specify some JVM arguments when calling a jar file like so:
I'm calling importtsv from within a Java class and for some reason it's not
I am calling a vendor's Java API, and on some servers it appears that
I've been struggling with doing some relatively straightforward regular expression matching in Java 1.4.2.
I'm in the process of doing some Java<->.NET interop code using a native library
I'm making an application where I need to scroll some text on a java.awt.Canvas
When doing a simple performance measurement, I was astonished to see that calling String.IndexOf(char)
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing some jquery animation. I have certain divs set up with an attribute of
I am calling a web service (written in Java) in my web app. I

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.