Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: standalone swing application runtime reload class Date: Fri, 24 Jul 2015 15:13:23 -0400 Organization: A noiseless patient Spider Lines: 35 Message-ID: References: <054550d0-d7e6-48f4-8faf-13e58bbfe8e6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 24 Jul 2015 19:11:56 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="23903"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+aF3h7ezU4HfUvvLq9aw4w" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: Cancel-Lock: sha1:M1dYI6B8XKnb/ek3QqeZ9SWWb8c= Xref: csiph.com comp.lang.java.programmer:32123 On 7/24/2015 2:39 PM, Joerg Meier wrote: > On Fri, 24 Jul 2015 14:11:09 -0400, Eric Sosman wrote: > >> ... but it's possible I've underestimated the importance of >> keeping "the same" app running. What is the app like, and why do >> you think reload-on-the-fly would be helpful? > > Without knowing how to help the OP, I thought maybe I could clarify - > JRebel will allow you to reload updated class files, allowing you to change > behaviour on the fly. The app wouldn't be 'restarted', and instead you can > very easily test specific code without having to produce some sort of > artificial test harness. I'm not familiar with JRebel -- but ignorance has never stopped me from shooting off my mouth! However, the O.P. mentioned that he's running a "standalone Swing application," which suggests to me that his class participates in an on-screen window of some kind. Perhaps he's written a visible component like a subclass of JFrame or JTable, or maybe he's written something that isn't directly visible but lurks behind the scenes, like a custom SpinnerModel or a TableModel backed by a database connection. Either way, it seems likely that his class is "connected" to a bunch of other things and could only be reloaded by "disconnecting" the old instances and replacing them with new ones. That sounds tricky and error-prone, and likely to require exposing parts of the app that might ordinarily be private. For example, if his class is a custom TableModel he needs access to the JTable so he can replace the old model with the new one. (He also needs to copy the old model's data to the new one, which might be problematic -- The likely reason to want to reload the class is that the old one doesn't work right!) Anyhow, I hope he'll tell us more about his situation. -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM