here's a sample of code that would send an e-mail using mail command under Linux.
I guess that the exe probably should be within your PATH....
As you can observe, cmd[0] is the name of the app
cmd[1], cmd[2], .....are command line arguments to the app....
private static void sendMail(String mailTo, String subject, String body) throws IOException {
String []cmd = new String[3];
cmd[0] = new String("mail");
cmd[1] = new String("-s SUBJECT - " + subject);
cmd[2] = new String(mailTo);
Process mailProc = Runtime.getRuntime().exec(cmd);
OutputStream outStream = mailProc.getOutputStream();
outStream.write(body.getBytes());
outStream.flush();
outStream.close();
}
hope this helps
c.
Patrick Kosiol wrote:
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]>
