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 14:11:09 -0400 Organization: A noiseless patient Spider Lines: 28 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 18:09:42 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="9595"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jVbdUnDGhqHt4kLKxWMWj" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <054550d0-d7e6-48f4-8faf-13e58bbfe8e6@googlegroups.com> Cancel-Lock: sha1:2/pbC8x04RjVwqobzRhoagF/bb8= Xref: csiph.com comp.lang.java.programmer:32119 On 7/24/2015 12:35 PM, mcheung63@gmail.com wrote: > Hi > JRebel can reload classes running on tomcat. How about standalone app? how can i real time reload it? > thanks 1) It can probably be done. 2) You probably don't want to. For (1), I think you'd use a new ClassLoader to load the new version of the class; this is allowed because classes loaded by different ClassLoaders are different classes, even if they happen to have the same package and class names. Then you'd get rid of all the instances of the old class (JFrames, JPanels, whatever) and replace them with instances of the new one. For (2), note that (1) requires a Whole Lot of Extra Work on your part, and you'll spend a lot of time writing and debugging it. In that time, you could have closed the old app and launched the new one a few hundred times at least. ... 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? -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM