Before anyone says 'Google it', I HAVE Googled this. Everything I try doesn't work. The only one that DID work, ignored the JAVA execution and focused on the command prompt, so it gave me [java -jar C:\FileDir\file.jar nogui] and stopped, when I terminated it via Command Prompt, it showed the 'pause' command. Nothing from JAVA showed, but I do know that the .jar provided some information, as the files that it would create were indeed made.
Ok, now that that is over, I am tying to Append the console when the program is executed. It is a live function and does not terminate until a halt command is provided. I have the halt command and everything in place, however it does not show the console in the RichTextBox as I need it to. I have tried to alter code after code and indeed make my own, but to no avail. The console itself shows constant lines of text, (such as '[CORE] Setup is initilizing' or '[CRITICAL] File 'axmla.xaml' cannot be found') but what I need to do is append those lines as they are made and input them to the RTB.
This is what I have so far...
_commandExecutor.Execute("java.exe", " -jar file.jar")
Public Class CommandExecutor
Implements IDisposable
Public Event OutputRead(ByVal output As String)
Private WithEvents _process As Process
Public Sub Execute(ByVal filePath As String, ByVal arguments As String)
If _process IsNot Nothing Then
Throw New Exception("The service is already started.")
End If
_process = New Process()
_process.StartInfo.FileName = filePath
_process.StartInfo.Arguments = arguments
_process.StartInfo.UseShellExecute = False
_process.StartInfo.RedirectStandardInput = True
_process.StartInfo.RedirectStandardOutput = True
_process.Start()
_process.BeginOutputReadLine()
End Sub
Private Sub _process_OutputDataReceived(ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) Handles _process.OutputDataReceived
If _process.HasExited Then
_process.Dispose()
_process = Nothing
End If
RaiseEvent OutputRead(e.Data)
End Sub
Private disposedValue As Boolean = False
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
If _process IsNot Nothing Then
_process.Kill()
_process.Dispose()
_process = Nothing
End If
End If
End If
Me.disposedValue = True
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
I'm hoping someone will understand. If you need further clarification,
DO NOT SAY 'This makes no sense!' or start up with the stupid remarks. Just say 'Explain more please, it's hard to understand what you mean'