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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:17:21+00:00 2026-05-17T17:17:21+00:00

I have a .net app that needs to spawn a console process (a java

  • 0

I have a .net app that needs to spawn a console process (a java app) and capture the output in order to respond to it in various ways.

I’m not having much trouble getting the process spawned, and getting most output, but some of it is missing. I am assuming it’s somehow not going to “standard output”, but I need to find out how to capture it.

Public Sub Start()
    Dim cmdArgs As String
    cmdArgs = "-jar """ & Config.ServerJar & """"

    '' Configure the main server process
    mServerProcess = New Process
    With mServerProcess.StartInfo
        .WorkingDirectory = Config.WorkingDirectory
        .FileName = Config.Java
        .Arguments = cmdArgs
        .UseShellExecute = False
        .CreateNoWindow = True
        .RedirectStandardError = True
        .RedirectStandardInput = True
        .RedirectStandardOutput = True
    End With

    '' Wire up an event handler to catch messages out of the process
    AddHandler mServerProcess.OutputDataReceived, AddressOf OutputHandler
    AddHandler mServerProcess.ErrorDataReceived, AddressOf ErrorHandler

    '' Start the server process
    mServerRunning = False
    mServerProcess.Start()

    '' Wire up the writer to send messages to the process
    Dim ioWriter As IO.StreamWriter = mServerProcess.StandardInput
    ioWriter.AutoFlush = True

    '' Start listening for output
    mServerProcess.BeginOutputReadLine()

    '' Sleep for a while to let the server settle
    Threading.Thread.Sleep(5000)

    '' Send test command to the server
    ioWriter.WriteLine("test")

    '' Wait for the server to terminate
    mServerProcess.WaitForExit()
    mServerRunning = False

End Sub

Private Sub OutputHandler(ByVal SendingProcess As Object, _
                          ByVal OutLine As DataReceivedEventArgs)

    If Not OutLine.Data Is Nothing Then
        Debug.Print("STD:" & OutLine.Data)
    End If
End Sub

So, my question is, how can I either all console output?

  • 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-17T17:17:21+00:00Added an answer on May 17, 2026 at 5:17 pm

    I’m an idiot.

    I forgot to turn on error output.

        mServerProcess.BeginOutputReadLine()
    

    should be

        mServerProcess.BeginOutputReadLine()
        mServerProcess.BeginErrorReadLine()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a NET app that gets installed to the Program Files folder. The
I have this .NET web app that draws a table in Page_Load. Then after
I have a .Net 2.0 app that is used internally and we want to
Assume I have an ASP.NET MVC app that's not doing anything too fancy (no
I have a complex .NET Remoting server app that provides a couple of services.
I have an ASP.NET app running in IIS that is hosting files all great
I have a simple .NET 2.0 windows form app that runs off of a
I have an App that will send authenticated emails using System.Net.Mail and System.Net.NetworkCredential my
I have an app that is a combination of asp/asp.net, and both sides depend
I have an asp.net mvc app running on a local iis website that is

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.