2 Replies Latest reply: Dec 23, 2013 4:43 PM by baftos RSS

How do I Capture seagull output?

72e3fbac-ec36-4846-9736-6fd3a476f5f3 Newbie
Currently Being Moderated

Hi All

 

I am very beginner in Java programming

 

This piece of code displays for me, content of folder.

 

class Connect {

    String s;

    Connect() throws Exception {

    }

    Void SendMessage() throws Exception {

        Runtime runtime = Runtime.getRuntime();

        Process p = runtime.exec("ls");

        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));

        while ((s = in.readLine()) != null)

                System.out.println(s);

                p.waitFor();

        return null;

    }

}

 

If I use same code, replacing "ls" with "seagull" This code do not display anything. If I run seagull on Linux command line I get display, I expected to get same display when I run same command with Java

 

Here is the display from seagull command outside Java code

 

option -conf is mandatory

seagull

Version tool   : 1.8.2

Command syntax :

-conf <configuration file name>

-scen <scenario file name>

-dico <protocol dictionary file name> can be used more than once

[ -log <logging file name> ]

[ -llevel <logging level mask> ] levels:

          M: msg,     B: buffer,   E: error,

          W: warning, N: no error, T: traffic error,

          V: Verdict, U: User,     A: all.      Default E

[ -help  ] display syntax command line

[ -bg  ] background mode

[ -notimelog  ] no time stamp on the log (default time stamp)

[ -msgcheck  ] check the field of the messages received (default no check)

[ -ctrl  ] remote control active on @IP:port (default no remote)

[ -ctrldicopath  ] remote dictionary path (default remote-ctrl.xml in

                   /opt/seagull/config)

[ -rsptimelog <response logging file name> ]

 

 

Here is the modified code to run seagull command, it displays nothing

 

class Connect {

    String s;

    Connect() throws Exception {

    }

    Void SendMessage() throws Exception {

        Runtime runtime = Runtime.getRuntime();

        Process p = runtime.exec("seagull");

        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));

        while ((s = in.readLine()) != null)

                System.out.println(s);

                p.waitFor();

        return null;

    }

}

 

 

I will appreciate any suggestion

 

Thanks

Rajabu

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points