Ali,
It seems that it is working in the background but I'm not able to read out
the messages. Am I doing something wrong ????
ProcessStartInfo p = new ProcessStartInfo("C:\\javac.exe",
"C:\\Hello.java");
p.RedirectStandardOutput=true;
p.RedirectStandardError=true;
p.UseShellExecute=false;
p.CreateNoWindow=true;
Process ps = Process.Start(p);
this.label1.Text=ps.StandardOutput.ReadLine(); //reads nothing...??
When I run it from the console I get these error messages:
C:\javac.exe Hello.java
Hello.java:3: invalid method declaration;
return type required
public sayHello()
^
Hello.java:5: write(java.lang.String) has
private access in java.io.PrintStream
System.out.write("hello");
^
2 errors
Thanks a lot !!!!
"Ali" <aa*******@gmail.com> wrote in message
news:86**********************************@microsof t.com...
When calling the System.Diagnostics.Process.Start() method, pass it an
object of type ProcessStartInfo with the following properties set:
ProcessStartInfo p=new ProcessStartInfo("ConsoleApplication1.exe");
p.RedirectStandardOutput=true;
p.RedirectStandardError=true;
p.UseShellExecute=false;
p.CreateNoWindow=true;
Process ps = Process.Start(p);
this.label1.Text=ps.StandardOutput.ReadLine();
now when the procss starts, it doesnot have a window (so no console
window) and all the output to the standard output and standard error stream are
redirected to the ps.StandardOutput stream and can be read using any of
the stream access mechenisms (such as ReadLine being used in the above
sample).
Hope this helps
Ali Gardezi