Calling Python From Java (tomcat6) As Sub-process
Solution 1:
The explanation is probably one (or more) of following:
The command is failing and writing error messages to its "stderr" fd ... which you are not looking at.
The command is failing to launch because the command name is incorrect; e.g. it can't be found on
$PATH
.The command is trying to read from its
stdin
fd ... but you haven't provided any input (yet).It could be a problem with command-line splitting; e.g if you are using pathnames with embedded spaces, or other things that would normally be handled by the shell.
Also, since this is python, this could be a problem with python-specific environment variables, the current directory and/or the effective user that is executing the command.
How to proceed:
Determine if the python command is actually starting. For instance. "hack" the "" to write something to a temporary file on startup.
Change to using
ProcessBuilder
to create theProcess
object. This will give you more control over the streams and how they are handled.Find out what is going to the child processes "stderr". (ProcessBuilder allows you to redirect it to "stdout" ...)
Post a Comment for "Calling Python From Java (tomcat6) As Sub-process"