通过webapp重启tomcat [英] Restart tomcat through webapp

查看:37
本文介绍了通过webapp重启tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于通过我的 web 应用程序重新启动 tomcat 服务器的疯狂请求.我为此搜索了近 2 天,我发现的所有内容都是执行外部批处理文件或调用另一个程序来执行此操作.使用java代码是否有任何最佳解决方案?我错过了什么吗?

I have a crazy request about restarting tomcat server through my webapp. I was searching for nearly 2 days about this and all i found are executing external batch file or calling another program to do it. Is there any optimal solution for this by using java code? Am i missing something?

推荐答案

为什么不创建一个脚本并通过 Runtime.exec 调用它?对我来说似乎非常理想.由于重新启动 tomcat 将终止 Java VM,因此将其作为 API 调用实际上没有意义.

Why not just create a script an call it trough Runtime.exec? Seems quite optimal to me. Since restarting tomcat will terminate the Java VM, it doesn't really make sense to have it as an API call.

这篇关于通过webapp重启tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆