1

I created a new exe with a C# script which I then execute inside of a Java program. The exe will pull a string from a process that is running and print it to the screen. I was wondering how to access that string in the exe through Java, if there is a way.

1
  • 1
    might be best to just have java also pull from the process that is running. Aside from that, could always try some c# / java interop. stackoverflow.com/questions/16689/… Commented Jun 22, 2015 at 21:03

1 Answer 1

3
Process proc = Runtime.getRuntime().exec(...);
InputStream in = proc.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String txt = null;
while ((txt = br.readLine()) != null) {
  //...
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you it worked. I was using the wrong buffer and stream! Much appreciated. Will accept the answer when I can :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.