Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > using runtime exec()

Reply
Thread Tools

using runtime exec()

 
 
anu
Guest
Posts: n/a
 
      09-08-2008
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
 
Reply With Quote
 
 
 
 
Hendrik Maryns
Guest
Posts: n/a
 
      09-08-2008
-----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-----
 
Reply With Quote
 
 
 
 
Dave Miller
Guest
Posts: n/a
 
      09-08-2008
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/
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      09-08-2008
On Mon, 8 Sep 2008 06:30:34 -0700 (PDT), anu <(E-Mail Removed)>
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime.exec(String[]) Doesn't Always Work, bBut Runtime.exec(String) Does Hal Vaughan Java 11 05-22-2006 04:49 PM
using <runtime> section in web.config file Subra Mallampalli ASP .Net 8 01-21-2005 08:43 PM
How can i change de cssclass of a textbox in runtime using javascript Fernando Lopes ASP .Net 1 11-22-2004 08:29 PM
using custom error pages w/ runtime errors Steve Klett ASP .Net 0 11-12-2003 05:24 PM
ASP.NET using ADO.NET connection runtime error Matt ASP .Net 1 10-27-2003 04:14 AM



Advertisments