1
我想通過C#編譯一個Java程序。有誰知道爲什麼我不能接受程序的輸出,而我可以接受錯誤?我怎樣才能打印.java的結果?用C編譯java#
Process p = new Process(); p.StartInfo.FileName = "C:\\Program Files\\Java\\jdk1.7.0_04\\bin\\javac";
p.StartInfo.UseShellExecute = false;
p.StartInfo.Arguments = "c:\\java\\upgrade.java";
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
p.WaitForExit();
resultcode.Text = p.StandardOutput.ReadToEnd();
你是什麼意思的「程序的輸出」?你的意思是編譯器的輸出嗎? –