Tomcat外部可执行调用

时间:2013-05-09 13:12:19

标签: java tomcat jboss glassfish ejb

我正在使用在Tomcat 5环境中运行的应用程序。此应用程序需要调用外部应用程序(Delphi Executable)。我使用以下命令行进行调用:

Process pr = rt.exec(PatToDelphiExe);
pr.waitFor();

当我启动tomcat作为应用程序时,也启动应用程序delphi exe,但是,当tomcat作为服务启动时,delphi exe也会作为tomcat服务“作为服务”启动。

即使通过tomcat服务进行调用,我也需要将delphi exe作为应用程序启动。

我还尝试从Apache lib下面的代码,但没有成功:

CommandLine cmdLine = CommandLine.parse(PathToDelphiExe);
DefaultExecutor executor = new DefaultExecutor();
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
executor.setExitValue(1);
executor.execute(cmdLine, resultHandler);

0 个答案:

没有答案