高分求助,C#如何执行Java程序并获取返回值

如题所述

Process p=new Process();
p.StartInfo.FileName = "cmd.exe"; //要执行的程序名称
p.StartInfo.UseShellExecute = false; //不使用WindowsShell
p.StartInfo.RedirectStandardInput = true; //可能接受来自调用程序的输入信息
p.StartInfo.RedirectStandardOutput = true; //由调用程序获取输出信息
p.StartInfo.RedirectStandardError = true; //错误输出重定向
p.StartInfo.CreateNoWindow = true; //不显示程序窗口
p.Start(); //启动命令提示符
p.StandardInput.WriteLine("java -jar x:/xxx/xxx.jar");
温馨提示:内容为网友见解,仅供参考
第1个回答  2017-05-11
直接调用呀
相似回答