Results 1 to 2 of 2
  1. #1
    thyvo is offline Member
    Join Date
    Jun 2012
    Posts
    1
    Rep Power
    0

    Default Creating program to monitor a server application (both running on the same machine)

    Hello,
    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
    Java Code:
    java -Xmx1024M -Xms512M -jar server.jar nogui
    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

    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

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default 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.

Similar Threads

  1. Replies: 1
    Last Post: 06-18-2011, 04:28 PM
  2. running program on sftp server not working
    By hardcorebadger in forum New To Java
    Replies: 9
    Last Post: 01-14-2011, 02:59 PM
  3. Replies: 3
    Last Post: 12-24-2009, 07:04 AM
  4. Maintain same session in two application running on same server
    By dsiwal in forum Threads and Synchronization
    Replies: 2
    Last Post: 06-10-2008, 06:38 AM
  5. Replies: 0
    Last Post: 04-04-2008, 02:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •