简体   繁体   English

如何使用Java与已经运行的进程进行交互

[英]How to interact with already running process using java

Lets say i already have an application running in my computer (hlds.exe) Now how do i actually send commands to it. 可以说我已经在我的计算机上运行了一个应用程序(hlds.exe)。现在我如何实际向其发送命令。 It is running using console. 它正在使用控制台运行。 I need to send commands "restart", "ChangeLevel" using java. 我需要使用Java发送命令“ restart”,“ ChangeLevel”。 How do i do that? 我怎么做?

Thanks for your help 谢谢你的帮助

Starting from J2SE 5.0 release Java Management Extensions (JMX) was introduced to provide a mechanism form managing resources dynamically at runtime. 从J2SE 5.0版本开始,引入了Java管理扩展(JMX),以提供一种在运行时动态管理资源的机制。 It is an excellent way to manage/obtain current state of any running application. 这是管理/获取任何正在运行的应用程序当前状态的绝佳方法。

The JMX can be achieved by creating Managed Beans (MBeans) and then register it to the MBean Server. 通过创建托管Bean(MBean),然后将其注册到MBean服务器,可以实现JMX。

For more details read here 欲了解更多详情,请点击这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM