简体   繁体   English

在Eclipse中调试正在运行的Java应用程序?

[英]Debug a running java application in eclipse?

I am developing a java application which gathers some data, processes it and serialize them every 30 minutes into a file which makes it a time sensitive in that way. 我正在开发一个Java应用程序,该程序收集一些数据,对其进行处理,并每30分钟将它们序列化为一个文件,从而使该文件具有时间敏感性。 During the test mode, this writing-to-file feature is disabled. 在测试模式下,此写文件功能被禁用。

I started the application by mistake in test mode and it is running since last few hours collecting data in memory but data isn't written into file as application is running in test mode. 我在测试模式下错误地启动了该应用程序,并且由于最近几个小时在内存中收集数据而开始运行,但是由于应用程序在测试模式下运行,因此数据未写入文件中。 Though it would keep collecting data until it writes it into a file, which would never happen. 尽管它将一直收集数据,直到将其写入文件为止,这永远不会发生。

Is there a way to change the execution mode from "run" to "debug" or pause it and run some operations on in-memory data such as run a method manually that write them in a file? 有没有一种方法可以将执行模式从“运行”更改为“调试”或暂停它,并对内存中的数据运行某些操作,例如手动运行将其写入文件的方法?

Sorry to say, but no. 很抱歉,但没有。 When you run in debug mode, the JVM is started in such a way that a debugger can interact with the running classes. 在调试模式下运行时,JVM的启动方式使调试器可以与正在运行的类进行交互。 An already running JVM would not allow those collaborations post-startup, partially by inadvertent design and partially as a security measure. 已经运行的JVM不允许在启动后进行这些协作,部分是由于疏忽的设计,部分是出于安全措施。

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

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