• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Java class hotswap

Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is anyone using the hotswap feature in Java to reload classes? I found you can modify the source code in eclipse while a program is running and the changes will appear in the program. This does only only changes to method bodies though but tools like JRebel and DCEVM are extending this.

This seems to be useful in GUI programs as it saves restarting the program and finding the dialog you were working on, or inputting values again. It's more convenient to change individual ui controls interactively and see the changes as you're writing them. I wish I tried this earlier as it would have saved time restarting programs and going though repetitive ui actions.

What are the best ways to take advantage of this? One thing I found was that you'd need to calculate values each time they're used instead of once at the beginning. So instead of:

you can use:

You can also have a button to do a partial reinitialization of the state of the program. In case you want to change the initial values as the program is running.
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic