You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Patrick Kosiol <ko...@simu.de> on 2003/01/21 12:35:03 UTC

EXECUTE an external .exe-file (+Parameters) that creates data-files I want to use later in my servlet

Hi,

I'm runnung TomCat 4.0.4 and I want to start an external .exe-File.
My Code:

       String[] runString = {relativeDataPath + "data.exe",
         parameter0, parameter1, parameter2, parameter3};
       Process p = Runtime.getRuntime().exec(runString);
       System.out.println(runString);
       if(p.waitFor() == 0){
         ........

The 'data.exe'-File is placed in 
$CATALINA_HOME/webapps/ROOT/relativeDataPath so it should be no problem 
to access this File. The Number of  Parameters etc. is OK.
But I get the following Error-Message:

java.io.IOException: CreateProcess: 'relativeDataPath'/bfpldata.exe 
parameter0 parameter1 parameter2 parameter3 error=2

error=2 means imho that the File is not found. How can I execute my file 
to do that, what I want. Is it possible that the process can create 
files in the Tomcat folders?


Thx
Patrick


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: EXECUTE an external .exe-file (+Parameters) that creates data-filesI want to use later in my servlet

Posted by John Burgess <jo...@riskdecisions.com>.
I think you'll need the full (absolute) path to the exe.  There is a call in
the servlet api to translate a relative path to an absolute path in the
server's file system but I can't remember what it is.
Otherwise, put data.exe somewhere on the system path and drop the relative
directory part.

----- Original Message -----
From: "Patrick Kosiol" <ko...@simu.de>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, January 21, 2003 11:35 AM
Subject: EXECUTE an external .exe-file (+Parameters) that creates
data-filesI want to use later in my servlet


> Hi,
>
> I'm runnung TomCat 4.0.4 and I want to start an external .exe-File.
> My Code:
>
>        String[] runString = {relativeDataPath + "data.exe",
>          parameter0, parameter1, parameter2, parameter3};
>        Process p = Runtime.getRuntime().exec(runString);
>        System.out.println(runString);
>        if(p.waitFor() == 0){
>          ........
>
> The 'data.exe'-File is placed in
> $CATALINA_HOME/webapps/ROOT/relativeDataPath so it should be no problem
> to access this File. The Number of  Parameters etc. is OK.
> But I get the following Error-Message:
>
> java.io.IOException: CreateProcess: 'relativeDataPath'/bfpldata.exe
> parameter0 parameter1 parameter2 parameter3 error=2
>
> error=2 means imho that the File is not found. How can I execute my file
> to do that, what I want. Is it possible that the process can create
> files in the Tomcat folders?
>
>
> Thx
> Patrick
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org