You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jzhao <jz...@vbi.vt.edu> on 2002/06/18 22:40:45 UTC

exec an application and write output to a file

Hi there,

I was trying to run a .exe in my web service with Java runtime. The code looks like:

command = "teiresias_char -l"+ L + " -w"+ W
       +" -i"+ inputFile
       +" -o"+ resultFile
     + " -c"+ C +" -k"+ K +" -s";


  Runtime rt = Runtime.getRuntime();
  try {
   Process p=  rt.exec(command);
   re = new BufferedInputStream (p.getInputStream());
   re.close();
   System.out.println("excecution suceed.");


   }
   catch (IOException ex)
   {
    System.out.println("command is not executable!");
       }

so when the command has been executed, i should get the result written to a file named "resultFile". The server implementation runs well on my local machine ( I got the result file). However, after I deployed it to the Tomcat/Axis (beta2) and tested with a small local client,  I got the "excecution succeed" message, but I didn't see any result file generated. and later when i tried to read from that file, I got "FileNotFoundException".

Any clue what's going on here?

Thanks a lot!
Zoe 

Re: exec an application and write output to a file

Posted by Heitzso <he...@bellsouth.net>.
quick suggestion -- scan all drives and al ldirectories
for the output.  If on linux try running updatedb from
root and then 'locate blat' to find the file.

Just a thought ...

On Tue, 2002-06-18 at 16:40, jzhao wrote:
> Hi there,
> 
> I was trying to run a .exe in my web service with Java runtime. The code looks like:
> 
> command = "teiresias_char -l"+ L + " -w"+ W
>        +" -i"+ inputFile
>        +" -o"+ resultFile
>      + " -c"+ C +" -k"+ K +" -s";
> 
> 
>   Runtime rt = Runtime.getRuntime();
>   try {
>    Process p=  rt.exec(command);
>    re = new BufferedInputStream (p.getInputStream());
>    re.close();
>    System.out.println("excecution suceed.");
> 
> 
>    }
>    catch (IOException ex)
>    {
>     System.out.println("command is not executable!");
>        }
> 
> so when the command has been executed, i should get the result written to a file named "resultFile". The server implementation runs well on my local machine ( I got the result file). However, after I deployed it to the Tomcat/Axis (beta2) and tested with a small local client,  I got the "excecution succeed" message, but I didn't see any result file generated. and later when i tried to read from that file, I got "FileNotFoundException".
> 
> Any clue what's going on here?
> 
> Thanks a lot!
> Zoe