PLEASE Help!!!!!!!!!!!!!!!!!!!!!!!!!!

I'm trying to run an executable from a servlet using
Runtime.getRuntime().exec()

It just doesn't work. I get two kinds of IOException
errors:

1. If I specify the full path of my executable file, I
get an IOException, whose StackTrace says it has
generated a CreateProcess: error=5

2. If I don't specify the full path and instead put my
executable in the "/server/servlets" directory, I get
a similar IOException, with StackTrace saying
CreateProcess: error=2

My executable does some file processing and does not
output to the console at all, so accessing its console
output to see what it's doing is not even an issue.

Instead I'm able to check the resulting files it
alters. I've done this: it doesn't even touch them. It
has never even got a chance to run.


This is my (typical) exec() code:

 try {
     Process proc proc =
        Runtime.getRuntime().exec("c:\\cdir\\myExe");
     }
     catch (Exception e)
     {
           out.println("Exception!!!<BR>");
           e.printStackTrace(new
PrintWrite(out,true));
     }

And this is the exception that I get:

java.io.IOException: CreateProcess: parser error=2
at java.lang.Win32Process.<init>(Compiled Code)
at java.lang.Runtime.exec(Compiled Code)
at java.lang.Runtime.exec(Runtime.java:137)
at ParseQuery.service(Compiled Code)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at
com.sun.server.ServletState.callService(ServletState.java:210)
at
com.sun.server.ServletManager.callServletService(ServletManager.java:940)
at
com.sun.server.webserver.HttpServiceHandler.handleRequest(Compiled
Code)
at
com.sun.server.webserver.HttpServiceHandler.handleRequest(Compiled
Code)
at com.sun.server.HandlerThread.run(Compiled Code)


Any ideas of what could be causing this? exec() seems
to be a particularly nasty and troublesome command.

I rule out environment variables, my executable is
compiled PROLOG program that runs on DOS.

Also, this only happens within the servlet
environment. EXACTLY THE SAME code pasted into a java
Application works 100% fine.

Any ideas and hints will be appreciated.

I *need* to be able to execute this.

Thanks a lot

 -Martin


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

___________________________________________________________________________
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

Reply via email to