Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 tomcat 服务器中有一个 webapp。我也在tomcat服务器之外有一个java程序 - 在linux机器根目录中。我需要在外面调用 java 程序并获得对 webapp 的响应。这可能吗?
请给我一个答案?
提前致谢。
您可以在运行时对象上使用 exec 方法:
Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("whatever_you_want_to_run"); int exitVal = proc.exitValue();