using runtime exec()

A

anu

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
 
H

Hendrik Maryns

-----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-----
 
D

Dave Miller

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

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");
 
R

Roedy Green

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top