<%
try {
Process process = Runtime.getRuntime().exec( "cmd /C more.com c:\\file_id.diz"
);
DataInputStream in = new DataInputStream(
new BufferedInputStream( process.getInputStream() ) );
String s;
while ( null != ( s = in.readLine() ) ) {
out.println( s + "<br>" );
}
} catch ( IOException x ) {
out.println( x );
return ;
}
%>
The above code is ok under windows 2000, more.com is in winnt/system32, it will print
the content the file c:\file_id.diz, you can put data.exe in system path,
I hope the code is useful to you.
----- Original Message -----
From: "Patrick Kosiol" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 21, 2003 10:16 PM
Subject: Re: !!!HELP!!! how to execute an external .exe-file (+Parameters) that
creates data-files I want to use later in my servlet
> Hi,
>
> that might be a problem because my data.exe needs access to some
> data-files placed in a special relative path from its. And this programm
> also creates other files (they were also placed relative to its
> position) and I must also be able to access these files through out the
> Tomcat....
>
>
> Patrick
>
> ningr wrote:
>
> >I met the same problems under linux, maybe you should put the data.exe in the
>directory $CATALINA_HOME/bin, and
> >Process p = Runtime.getRuntime().exec( "./data.exe" );
> >you can try it.
> >
> >----- Original Message -----
> >From: "Patrick Kosiol" <[EMAIL PROTECTED]>
> >To: "Tomcat Users List" <[EMAIL PROTECTED]>
> >Sent: Tuesday, January 21, 2003 10:01 PM
> >Subject: !!!HELP!!! how to 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: <mailto:[EMAIL PROTECTED]>
> >>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >>
> >>
> >>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>