process with redirectstandardoutput closes cmd prompt before accepting input

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
im trying to run a java console application with the process class.
when i dont use RedirectStandardOutput, it runs as expected, but if i do, it closes as soon as the first line is output in the console, before accepting input + before outputting the information im trying to read:

<pre class="prettyprint lang-vb Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p As New Process
Dim psi As New ProcessStartInfo
psi.FileName = "java"
psi.Arguments = "-jar C:/Users/Paul/Documents/NetBeansProjects/timesTable/dist/timesTable.jar"
psi.UseShellExecute = False
psi.RedirectStandardOutput = True
p.StartInfo = psi
p.Start()
p.WaitForExit()
MsgBox(p.StandardOutput.ReadToEnd)
End Sub

End Class[/code]
does anyone know how to get this code working properly?<br/><hr class="sig thanks for any help

View the full article
 
Back
Top