使用Java应用程序进行处理并输出 [英] Process using java application and output

查看:43
本文介绍了使用Java应用程序进行处理并输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个Java应用程序.该应用程序正在运行,并将结果写入控制台.我正在使用java -jar application.jar
启动应用程序
我想在C#应用程序的控制台中使用这些行.为此:

Hi,

I have a java application. This application is running and writting the result in the console. I''m starting the application with java -jar application.jar

I want to use the lines in the console in a C# application. To do this :

Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;

p.StartInfo.FileName = "java.exe";
p.StartInfo.Arguments = " -jar application.jar";
p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);      
p.Start();



我的问题是p_OutputDataReceived函数中没有附加任何内容.
这个怎么做 ?

此致



My problem is that nothing append in the p_OutputDataReceived funtion.
How to do this ?

Sincerely,

推荐答案

您需要致电
You need to call BeginOutputReadLine[^] to receive this event.


这篇关于使用Java应用程序进行处理并输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆