0

I'm creating a simple Java application to pick up all console output from a specific Java application, but I cant figure out how to pick up all the data.

I'm going to use it for Minecraft Forge servers, to create a custom GUI for the server, and because batch-files which starts the server presents the data in the console, I guess the application uses the default System.out stream for writing to the console.

Any help with this is appreciated!

Thanks!

Daniel Kvist
  • 2,642
  • 5
  • 22
  • 48
  • 1
    possible duplicate of [Capturing stdout when calling Runtime.exec](http://stackoverflow.com/questions/882772/capturing-stdout-when-calling-runtime-exec) – Adrian Leonhard Feb 18 '15 at 16:10
  • If you don't want to start the minecraft server from your application, a simple option would be to redirect the server's output to a file and read that. – Adrian Leonhard Feb 18 '15 at 16:16
  • @AdrianLeonhard There is no problems starting it from my application, I think, but how do I redirect the output from the server to a file? – Daniel Kvist Feb 18 '15 at 16:18
  • 1
    Do that when starting the server, for example on windows: http://stackoverflow.com/questions/1420965/redirect-stdout-and-stderr-to-a-single-file – Adrian Leonhard Feb 18 '15 at 16:19
  • @AdrianLeonhard Is there a way to also send input back to the server application, so that I can excecute commands on the server, like /stop, /op etc.? – Daniel Kvist Feb 18 '15 at 16:33
  • If you start it from your application (see my first comment), yes, otherwise I'm not sure. – Adrian Leonhard Feb 18 '15 at 16:34
  • @AdrianLeonhard Okay, I'll try to start it from my application. How do I execute commands then? – Daniel Kvist Feb 18 '15 at 16:37
  • See http://stackoverflow.com/questions/18903549/writing-to-inputstream-of-a-java-process – Adrian Leonhard Feb 18 '15 at 16:55

0 Answers0