private void LaunchProcess(string class)
{
string app = varGlob.JAVADIR + "java.exe ";
string ex1 = "\"" + class+ "\"";
build.StartInfo.WorkingDirectory = varGlob.JAVADIR;
build.StartInfo.Arguments = ex1;
build.StartInfo.FileName = app;
build.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
build.StartInfo.UseShellExecute = false;
build.StartInfo.RedirectStandardOutput = true;
build.StartInfo.RedirectStandardInput = true;
build.StartInfo.RedirectStandardError = true;
build.StartInfo.CreateNoWindow = false;
build.ErrorDataReceived += build_ErrorDataReceived;
build.OutputDataReceived += build_ErrorDataReceived;
build.EnableRaisingEvents = true;
//build.Exited += build_Exited;
build.Start();
build.BeginOutputReadLine();
build.BeginErrorReadLine();
// build.StandardInput.WriteLine("5");
build.WaitForExit();
cmp.TME.error(str, 0);
cmp.TME.error("", 0);
cmp.TME.error("output generated.", 0);
}
void build_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
string strMessage = e.Data;
str += strMessage;
}
Replies
Know the answer? Post it — somebody with the same question will find it here.