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.
I tried to use the redirect arrow in a command from a bean, but that didn't work. I think it's easier and safer to actually capture the output in the outputstream, ie: BufferedReader br = new BufferedReader(new OutputStreamReader(proc.getOutputStream());
and then while reading it, write it to file...
S
_________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
___________________________________________________________________________ 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
