• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java class hotswap  RSS feed

Sresh Rangi
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!