i have a jar which if i run from the command line returns me a true or false printed to the console
i am trying to run this from c# and obtain the result - this is being done like this
Process p = new Process();
p.StartInfo = new ProcessStartInfo("java", @"-jar test.jar " + paramterForStringArgs[0]);
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();
String s = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Trace.WriteLine("data = " + s);
return false;
I seem to be always getting an empty string and was wondering why this might be, or if there was a better way of doing it?
Setting RedirectStandardError
and calling p.StandardError.ReadToEnd()
reads any error output from the process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With