Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32116 > unrolled thread

standalone swing application runtime reload class

Started bymcheung63@gmail.com
First post2015-07-24 09:35 -0700
Last post2015-07-24 20:21 -0700
Articles 9 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  standalone swing application runtime reload class mcheung63@gmail.com - 2015-07-24 09:35 -0700
    Re: standalone swing application runtime reload class Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-24 14:11 -0400
      Re: standalone swing application runtime reload class Joerg Meier <joergmmeier@arcor.de> - 2015-07-24 20:39 +0200
        Re: standalone swing application runtime reload class Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-24 15:13 -0400
          Re: standalone swing application runtime reload class Joerg Meier <joergmmeier@arcor.de> - 2015-07-24 21:15 +0200
          Re: standalone swing application runtime reload class mcheung63@gmail.com - 2015-07-24 20:21 -0700
    Re: standalone swing application runtime reload class Jeff Higgins <jeff@invalid.invalid> - 2015-07-24 16:57 -0400
      Re: standalone swing application runtime reload class Jeff Higgins <jeff@invalid.invalid> - 2015-07-24 22:21 -0400
      Re: standalone swing application runtime reload class mcheung63@gmail.com - 2015-07-24 20:21 -0700

#32116 — standalone swing application runtime reload class

Frommcheung63@gmail.com
Date2015-07-24 09:35 -0700
Subjectstandalone swing application runtime reload class
Message-ID<054550d0-d7e6-48f4-8faf-13e58bbfe8e6@googlegroups.com>
Hi
   JRebel can reload classes running on tomcat. How about standalone app? how can i real time reload it?
thanks
from Peter (cmk128@hotmail.com)

[toc] | [next] | [standalone]


#32119

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2015-07-24 14:11 -0400
Message-ID<motv16$9br$1@dont-email.me>
In reply to#32116
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

[toc] | [prev] | [next] | [standalone]


#32121

FromJoerg Meier <joergmmeier@arcor.de>
Date2015-07-24 20:39 +0200
Message-ID<ys6gfds4kaeg.1gp62z2t0gmkq$.dlg@40tude.net>
In reply to#32119
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.

Liebe Gruesse,
		Joerg

-- 
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.

[toc] | [prev] | [next] | [standalone]


#32123

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2015-07-24 15:13 -0400
Message-ID<mou2ls$nav$1@dont-email.me>
In reply to#32121
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

[toc] | [prev] | [next] | [standalone]


#32124

FromJoerg Meier <joergmmeier@arcor.de>
Date2015-07-24 21:15 +0200
Message-ID<169vx15uhnyq2$.18uw3cs8qx07w.dlg@40tude.net>
In reply to#32123
On Fri, 24 Jul 2015 15:13:23 -0400, Eric Sosman wrote:

> 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!)

What you describe is pretty much what JRebel does ;)

Liebe Gruesse,
		Joerg

-- 
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.

[toc] | [prev] | [next] | [standalone]


#32132

Frommcheung63@gmail.com
Date2015-07-24 20:21 -0700
Message-ID<0ea45244-e381-4743-85cd-0c6082097ad3@googlegroups.com>
In reply to#32123
thanks, what you said is exactly my suituation. i have some visual and not visual classes that want to reload. 

[toc] | [prev] | [next] | [standalone]


#32129

FromJeff Higgins <jeff@invalid.invalid>
Date2015-07-24 16:57 -0400
Message-ID<mou91k$es2$1@dont-email.me>
In reply to#32116
On 07/24/2015 12:35 PM, mcheung63@gmail.com wrote:
> Hi
>     JRebel can reload classes running on tomcat.

> How about standalone app?

Running JRebel with Standalone application
<https://zeroturnaround.com/forums/topic/running-jrebel-with-standalone-application/>
I don't know if this question matches your question.

> how can i real time reload it?

JRebel installation and configuration guide
<http://manuals.zeroturnaround.com/jrebel/>

> thanks

[toc] | [prev] | [next] | [standalone]


#32131

FromJeff Higgins <jeff@invalid.invalid>
Date2015-07-24 22:21 -0400
Message-ID<mous06$8nh$1@dont-email.me>
In reply to#32129
On 07/24/2015 04:57 PM, Jeff Higgins wrote:
> On 07/24/2015 12:35 PM, mcheung63@gmail.com wrote:
>> Hi
>>     JRebel can reload classes running on tomcat.
>
>> How about standalone app?
>
> Running JRebel with Standalone application
> <https://zeroturnaround.com/forums/topic/running-jrebel-with-standalone-application/>
>
> I don't know if this question matches your question.
>
>> how can i real time reload it?
>
> JRebel installation and configuration guide
> <http://manuals.zeroturnaround.com/jrebel/>
>
>> thanks
Still not sure this is what you're looking for, but...
<http://zeroturnaround.com/forums/topic/can-i-use-jrebel-with-a-standalone-app-no-container/>

[toc] | [prev] | [next] | [standalone]


#32133

Frommcheung63@gmail.com
Date2015-07-24 20:21 -0700
Message-ID<241fc821-1c63-447b-a83d-f961bea33f46@googlegroups.com>
In reply to#32129
thanks everybody

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web