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

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

问题描述

我有一个关于通过我的webapp重启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天全站免登陆