Re: unix command

Eric Noriega <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Organization The George Washington University, Department of Computer Science
Message-ID <[email protected]>
The redirect operator ">" is a shell construct.  You need to run a
shell, and have it redirect the output for you.

Dinesh Abichandani wrote:

>hi there
>I am trying to execute a unix command from servlet. Command woks fine when i
>try to get output on to terminal and this is the code for that:
>
>Process proc=null;
>    Runtime rt = Runtime.getRuntime();
>    proc = rt.exec(new String[] {"/vol1/people/dinesh/htblast/blockhead_64","-stdout","/vol1/people/dinesh/htblast/testfile.fsa","/vol1/people/dinesh/htblast/rules_file","1"});
>but when i try to redirect it to a file it is not working ,,though it works
>when i execute this command from command line in unix shell.here is the code for that:
>Process proc=null;
>    Runtime rt = Runtime.getRuntime();
>    proc = rt.exec(new String[] {"/vol1/people/dinesh/htblast/blockhead_64","-stdout","/vol1/people/dinesh/htblast/testfile.fsa","/vol1/people/dinesh/htblast/rules_file","1",">","test2.out"});
>where test2.out is the file where i want my output.
>i have tried giving the absolute path of test2.out but command didnt write to it.
>
>please advice
>dinesh
>
>___________________________________________________________________________
>To unsubscribe, send email to [email protected] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
>

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.