0

is it possible to gather information on all the existing variables within a running .jar file when it exits? I'm running an application on the linux command line of various servers and I try to debug an issue when the jar just stops working on 10% of the systems.

In Android, there is a method called onDestroy() which can be overwritten in order to perform tasks when the app exits. Is there something similar possible in native Java applications? And even if that is the case, how could I collect the data?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Dennis Winter
  • 2,027
  • 4
  • 32
  • 45
  • *"Thanks for helping! s."* I'll thank you for leaving out such noise in future. – Andrew Thompson Apr 13 '12 at 10:04
  • *"And even if that is the case, how could I collect the data?"* Separate question. Please put it on one. – Andrew Thompson Apr 13 '12 at 10:06
  • "I'll thank you for leaving out such noise in future." -> To some it's noise, to others politeness. Additionally, I don't see why I should split this question, as my initial question is clear and needs two steps to be accomplished. – Dennis Winter Apr 13 '12 at 12:00
  • [Stack Overflow is not a Social Network](http://meta.stackexchange.com/a/128552/155831). *"I don't see why I should split this question.."* Asking 2 questions & getting 1 answer is not enough of a hint for you? A person may know the answer to one, but not the other. Should that person avoid replying? – Andrew Thompson Apr 13 '12 at 12:04
  • I guess the both of us won't come to an agreement here. But I thank you for the advice, even if it's noise for you. – Dennis Winter Apr 13 '12 at 12:18

1 Answers1

2

In Android, there is a method called onDestroy()..

Add a shutdown hook.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433