【问题标题】:accessing information within c# script in java在java中访问c#脚本中的信息
【发布时间】:2015-06-22 20:59:53
【问题描述】:

我使用 C# 脚本创建了一个新的 exe,然后我在 Java 程序中执行该 exe。该 exe 将从正在运行的进程中提取一个字符串并将其打印到屏幕上。我想知道如何通过Java访问exe中的那个字符串,如果有办法的话。

【问题讨论】:

标签: java c# process scripting


【解决方案1】:
Process proc = Runtime.getRuntime().exec(...);
InputStream in = proc.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String txt = null;
while ((txt = br.readLine()) != null) {
  //...
}

【讨论】:

  • 谢谢你成功了。我使用了错误的缓冲区和流!非常感激。我会接受答案:D
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-19
  • 1970-01-01
  • 2023-03-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多