Changing values during runtime?

Hello
I know this seems like a silly question, I’m not that new to java, but somethings been bugging me

you see, when I watched Notch coding during the last LD competition over a livestream, it looked like he was editing values and adding whole chunks of code without needing to re-run it.

I kinda thought at first that maybe he was editing a properties file or something but when I looked closer he was actually changing things like the parameters for glColor3f or paths to textures and his applet would not restart. He would even add in more code like function calls if I remember correctly, it wouldn’t close or anything, he would be in the same position he was in when he started changing code and yet textures and colors would change as he coded it. He did restart sometimes but there didn’t seem to be a pattern in what he changed when he restarted and when he didn’t, though I can’t remember clearly.

From what I could tell I thought he was using eclipse, I can’t really remember now since it was quite a while ago, but I’m wondering if there was maybe some sort of special compiler or something that did this? I’ve searched the internet several times but to no avail…

This has been asked before and also answered around these boards. If You search around these boards You will find. You may want to use “hot swapping” as keywords.

If you use Eclipse it’s built in, it’s triggered when you save a source file when the program is being run under the debugger.

It’s under Preferences->Java->Debug, but IIRC it’s on by default.

Just to clear it up, hot swapping is a Java feature, supported by every IDE, not just Eclipse. There’s limits to what you can do with it, but any good IDE will tell you if your change isn’t hotswappable and requires a restart instead.

Thanks, I never heard the term hotswapping before, so I guess thats why I never found it :stuck_out_tongue:

And I will wait 24 hours before I “appreciate” sproingie, too, due to the recently acquired knowledge that appreciations close together in time are not worth as much as isolated appreciates.

Really nice to know this, about hot-swapping! Am looking forward to giving it a try.

It’s called “Apply code changes” located in the Debug menu in Netbeans for example. Unfortunately it can’t be configured to automatically run on save, so one keypress more :wink: