java 一种“重启”JVM的方法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14373258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
A way to "Reboot" the JVM
提问by quarks
Possible Duplicate:
Any way to “reboot” the JVM?
可能的重复:有什么
方法可以“重新启动”JVM?
I added tools.jar in our JRE /lib/ext folder and I need to do a JVM reboot under windows. Is that possible without restarting the server?
我在我们的 JRE /lib/ext 文件夹中添加了 tools.jar,我需要在 Windows 下重新启动 JVM。这可能不重新启动服务器吗?
回答by Stephen C
I added tools.jar in our JRE /lib/ext folder ...
我在我们的 JRE /lib/ext 文件夹中添加了 tools.jar ...
That is a bad idea. If you need to use stuff in 'tools.jar' you should be installing a JDK, not hacking a JRE installation.
那是个坏主意。如果您需要使用“tools.jar”中的内容,您应该安装 JDK,而不是破解 JRE 安装。
... and I need to do a JVM reboot under windows. Is that possible wihtout restarting the server?
...我需要在 Windows 下重新启动 JVM。不重启服务器可以吗?
Ermm ...
嗯...
If you are asking if it is possible to restart the application / server JVM without restarting the entire operating system, of course it is!
如果您问是否可以在不重新启动整个操作系统的情况下重新启动应用程序/服务器JVM,当然可以!
If you are asking if you need to restart the JVM to get it to see new stuff in '/lib/ext', then the answer is yes. The JVM reads that directory on startup and won't notice files that are written there while it is running.
如果您问是否需要重新启动 JVM 以使其在“/lib/ext”中看到新内容,那么答案是肯定的。JVM 在启动时读取该目录,并且在运行时不会注意到写入该目录的文件。
If you are asking how a JVM can reboot itself, see the linked question.
如果您询问 JVM 如何自行重启,请参阅链接的问题。
If you are asking how to restart the JVM / service from the outside, the answer is (probably) via the Windows service control GUI ... depending on which version of Windows you are using. (And that's not a programmingquestion ...)
如果您问如何从外部重新启动 JVM/服务,答案是(可能)通过 Windows 服务控制 GUI ...取决于您使用的 Windows 版本。(这不是编程问题......)
回答by TheWhiteRabbit
Server process typically runs on top of Java Runtime inside JVM. even if you succeed to re-boot JVM OR killing the Java process will result in the server process to terminate.
服务器进程通常运行在 JVM 内部的 Java 运行时之上。即使您成功地重新启动 JVM 或杀死 Java 进程也会导致服务器进程终止。