I am trying to call an external Java class file from a servlet running on Tomcat 6, Windows 7, 64bit . There are already some threads on this subject around, but none are really helping me.
Fyi, I have successfully been able to do this if I run it from the shell directly.
Im using a ProcessBuilder
to execute the command like this
ProcessBuilder bp = new ProcessBuilder("cmd.exe","/C","java", "TheExternalClass", "ParameterA" });
I'm also consuming the errorStream and inputStream from the created Process.
When I run it from the servlet it simply stalls.
If I for example swith the java command to dir it does work as expected, leading me to believe it has something to do with either memory, or issues starting up a new Java Process from Tomcat or something like that.
Anybody has a pointer or a good idea on how to solve this?
Some other posts on the topic:
http://www.javaworld.com/jw-12-2000/jw-1229-traps.html?page=1
call a java program from a webapp in tomcat server - the java program is out side of tomcat server
Tomcat fails to execute external java program
Thanks much for reading.