Creating program to monitor a server application (both running on the same machine)
I'm currently creating a java program that monitors a other java application(a server type application) in by default you alwase have to type code below in terminal/cmd
now I want my application to have a start/stop button, some sort of setting for my server (how mutch ram allocated etc...) I can manage those things using swing, no problem
java -Xmx1024M -Xms512M -jar server.jar nogui
Now my problem,
I wish to monitor the output of the server (what you normally see in terminal/cmd) to be shown in my program in real time and thats my problem, I have no clue where to look or how this is called.
if someone can point me out to some other treath or some example code would be nice :D
Re: Creating program to monitor a server application (both running on the same machin
I'm guessing that you'll start the server from within your application using either Runtime#exec(...) or using ProcessBuilder#start(), either way getting a Process object. Then you will want to get the Process's InputStream, OutputStream, and ErrorStream, and stream the results from the InputStream and ErrorStream to your application.