using runtime exec()

Discussion in 'Java' started by anu, Sep 8, 2008.

  1. anu

    anu Guest

    I am trying to use runtime exec within an emulator shell for ANDROID.
    The normal commands (such as logcat -c and ls) work. However, if I
    type logcat -d -f <filepath> the file is created but nothing is piped
    into it. If I type logcat -d > <filepath> even the file is not
    created. Please let me know if this is an issue with runtime exec.

    Thank you in advance!
    Anuradha Madhavan
     
    anu, Sep 8, 2008
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    anu schreef:
    > I am trying to use runtime exec within an emulator shell for ANDROID.
    > The normal commands (such as logcat -c and ls) work. However, if I
    > type logcat -d -f <filepath> the file is created but nothing is piped
    > into it. If I type logcat -d > <filepath> even the file is not
    > created. Please let me know if this is an issue with runtime exec.


    The latter is: pipes and redirections are a thing of the shell.
    Runtime.exec does *not* invoke a shell. So things like | and > do not
    work. The first syntax should work, however. How about an SSCCE?

    H.
    - --
    Hendrik Maryns
    http://tcl.sfs.uni-tuebingen.de/~hendrik/
    ==================
    Ask smart questions, get good answers:
    http://www.catb.org/~esr/faqs/smart-questions.html
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

    iEYEARECAAYFAkjFMpMACgkQBGFP0CTku6OC2ACgwh/yjn/WpVDULLSDuGrQOiqN
    zSAAnRyaUA5TCbIbWpX2gFBB6iXDi2pD
    =y2PM
    -----END PGP SIGNATURE-----
     
    Hendrik Maryns, Sep 8, 2008
    #2
    1. Advertising

  3. anu

    Dave Miller Guest

    anu wrote:
    > I am trying to use runtime exec within an emulator shell for ANDROID.
    > The normal commands (such as logcat -c and ls) work. However, if I
    > type logcat -d -f <filepath> the file is created but nothing is piped
    > into it. If I type logcat -d > <filepath> even the file is not
    > created. Please let me know if this is an issue with runtime exec.
    >
    > Thank you in advance!
    > Anuradha Madhavan

    I'm unfamiliar with Android and it's shell. If possible you can have
    runtime call the shell and then print to it rather than passing the
    arguments directly. On Linux it looks like:

    Runtime rt = Runtime.getRuntime();

    Process proc = rt.exec ("/bin/bash");

    PrintWriter out = new PrintWriter(new BufferedWriter(new
    OutputStreamWriter(proc.getOutputStream())));

    out.println("command");


    --
    Dave Miller
    Java Web Hosting
    http://www.cheap-jsp-hosting.com/
     
    Dave Miller, Sep 8, 2008
    #3
  4. anu

    Roedy Green Guest

    On Mon, 8 Sep 2008 06:30:34 -0700 (PDT), anu <>
    wrote, quoted or indirectly quoted someone who said :

    >I am trying to use runtime exec within an emulator shell for ANDROID.
    >The normal commands (such as logcat -c and ls) work. However, if I
    >type logcat -d -f <filepath> the file is created but nothing is piped
    >into it. If I type logcat -d > <filepath> even the file is not
    >created. Please let me know if this is an issue with runtime exec.


    yes. See http:://mindprod.com/jgloss/exec.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Sep 8, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hal Vaughan
    Replies:
    11
    Views:
    1,131
    Gordon Beaton
    May 22, 2006
  2. tedsuzman
    Replies:
    2
    Views:
    7,095
    Michel Claveau, résurectionné d'outre-bombe inform
    Jul 21, 2004
  3. Ted
    Replies:
    1
    Views:
    471
    Duncan Booth
    Jul 22, 2004
  4. Guillermo Riojas
    Replies:
    0
    Views:
    173
    Guillermo Riojas
    Nov 26, 2010
  5. Random Task
    Replies:
    12
    Views:
    658
    Joe Smith
    Dec 4, 2005
Loading...

Share This Page