I've got some c# code that launches a java process. On one machine running Windows 7 it works fine. On another running XP it doesn't. Here is the code...
mServerProcess = new Process(); mServerProcess.StartInfo.FileName = "java"; mServerProcess.StartInfo.Arguments = "-jar my.jar"; mServerProcess.StartInfo.WorkingDirectory = "C:\\my_server"; mServerProcess.StartInfo.UseShellExecute = false; mServerProcess.StartInfo.CreateNoWindow = true; mServerProcess.StartInfo.RedirectStandardOutput = true; mServerProcess.StartInfo.RedirectStandardError = true; mServerProcess.StartInfo.RedirectStandardInput = true; mServerProcess.OutputDataReceived += new DataReceivedEventHandler(ServerOutputHandler); mServerProcess.ErrorDataReceived += new DataReceivedEventHandler(ServerErrorHandler); mServerProcess.SynchronizingObject = this.console; // Start the process. mServerProcess.Start(); // Start the asynchronous read of the sort output stream. mServerProcess.BeginOutputReadLine(); mServerProcess.BeginErrorReadLine(); On the XP machine I never get the text coming from the process's standard error, and the process in general seems broken. I can't send it anything from the standard input stream.
Now... interestingly, if I comment out the code that redirects standard input, I DO get the standard error. But of course, I NEED to redirect standard input as well.
Has anyone seen this before?... where redirecting both standard input and standard error cause a problem?
And again... I don't have this problem on my windows 7 box.
Thanks, Buzz
UPDATE:
I'm using the java Logger class to output information from my java app. I think this problem is related to Java specifically and how its ConsoleHandler class deals with standard error. This is driving me nuts!