New Code Hot Swap Feature with BlackBerry Simulators


With the latest simulators and BlackBerry® Java Plug-in or BlackBerry® Web Plug-in, it’s possible to change your code and publish it to a running simulator without a reset. This new feature will greatly improve your development experience and is particularly valuable for those little UI tweaks when you’re working on getting something just perfect.

The hot swap feature is integrated right into the debugging process, so all you really need to change about your existing workflow is to stop closing the BlackBerry® Simulator. After you’ve launched the simulator and need to make a change to the code, just jump back to your code and make the change without closing your app or the simulator. When you’ve completed the change, run the debugging configuration that you ran before.

In the background, the tools will:

  1. Rebuild your code.
  2. Unload the modules from the running simulator.
  3. Load the new version to the simulator.
  4. Reconnect the debugger.
  5. Return to the application that was in the foreground.

So if you left your application in the foreground, you’ll see your changes without even launching the application again, and all this takes only a few seconds. Watch the video above to see an example of hot swap in action.

Added to the improvements is the simulator startup time; it’s faster and easier than ever to get developing on the simulators, and you still benefit from the simulators running the same Java code as the BlackBerry® smartphone does for outstanding accuracy.

If you upgraded from the BlackBerry® Java Plug-in for Eclipse® v1.1.1, make sure you are using the new JRE by following these steps:

  1. Manually select the upgraded BlackBerry JRE by navigating to Windows > Preferences > Java > Installed JREs.
  2. Select the old BlackBerry 5.0.0 JRE and click Edit.
  3. Change the Definition File by navigating to the new BlackBerry JRE (with the File button).
  4. In the components folder, select the file and click Finish
  5. Your Definition File path should look like this:

Have you tried out the hot swap feature yet? Leave us a comment and let us know how it worked out for you!

About Tim W.

Tim is an Open Source Technical Lead at BlackBerry, focusing on WebWorks, HTML5, and Open Source.

Join the conversation

Show comments Hide comments
+ -
  • pmilovanov

    Hi Tim

    Thanks a lot for providing details on the hotswap implementation! It's a bit of a bummer though that you guys decided to put eclipse plugin in charge of the hotswap, because if you use any kind of custom build process (ant or maven-based, like we do), you're left out in the cold.

    From that point of view, of course, it'd be much nicer to have the simulator itself detect a change in the cod files and initiate the hotswapping. Oh well. Hope you might consider that approach in the future, but meanwhile, of course, this is definitely a step forward.


  • iamtony

    Wow this is simply awesome. I've been waiting for this feature ever since I started developing. It's really a pain in the rear to constantly relaunch the simulator, especially when my computer is slow enough as it is. Now I won't have to wait 5 minutes for it to load every time I want to see a change.

  • Dima Kornilov

    I'm not using Eclipse. Want to know if this feature works with pure JDE 5.0.

  • twindsor

    Actually, this should be possible using Maven or Ant, if you create some new scripts to do the hotswapping. The following are the fledgecontroller commands that execute this:

    fledgecontroller /session=9550 /execute=LoadCod(“c:\temp\HelloWorldDemo.cod.pending”)
    fledgecontroller /session=9550 /execute=LoadCod(“updates.force”)

    * make sure the path separator in “LoadCod” is “\” (escaped)
    * just append “.pending” to the path to the cod you want hot swap; it doesn’t require you to create a physical “.pending” file
    * the “session” string should match that in 9550.bat (or similar simulator bat file)

    You'll also need to disconnect the debugging session before doing the hotswap and then reconnect afterwards (the Eclipse plugin does this as well).

  • bipop

    Is this work only with BlackBerry 5.0.0 JRE?

  • twindsor


    Yes this works in the JDE as well with the latest version. You'll need to turn on the “Reuse Simulator” ability in your 5.0 simulators. This setting is found in the simulator preferences under Edit->Preferences.

    Then you can edit your code while the simulator is running and use the Restart (Shift-F9) command in the Debug menu to load your new code.

  • dkonigs

    Any guidelines for hot-swapping applications that have auto-run-on-startup entry points? When running such an entry-point, my code throws all sorts of IllegalArgumentException errors when it does things like setting home-screen icons and does event source registration.

    I'm suspecting that the auto-start code gets run too soon in the hot-swap process, but I'm not entirely sure. Are there any good approaches for handling this code? (for the device-startup process, I can wait on ApplicationManager.inStartup(), but that doesn't work in the hot-swap case).

  • twindsor

    It only works with 5.0 simulators, but you can build an app with an earlier SDK, like 4.6.0 and hotswap it onto a 5.0 simulator.

  • twindsor

    I have not tried an autostart app myself. This is best handled through the issue tracker, if you can provide a sample app that is causing this problem for you, I will look into it.

  • baobei

    Is this supported by the Blackberry JDE or only Eclipse plugin?

  • pmilovanov

    Thanks Tim! Going to try this out.

  • Ketan

    I don't file under components directory.
    I am using Blackberry componentpack5.0.0_5.0.0.4
    the path is,
    C:Program Fileseclipsepluginsnet.rim.eide.componentpack5.0.0_5.0.0.4components


  • Juan


    I have been trying to create an ant script to do the hotswapping, but when I try to disconnect the debugging session from eclipse the simulator always exits. Is there a way to prevent the simulator from exiting when disconnecting the debugging session? Does this only happen on windows 7 64?

  • twindsor

    Make sure you've got the 1.1.2 Eclipse plugin installed and the latest 5.0 component pack. This should be as shown in the screenshot. Hotswap is not included in the older versions or in the 1.1.1 plugin.

  • twindsor

    The blog is not a very good place to try to figure this out. Can you post to the issue tracker?

  • Douglas tr0n Soltys

    Here is the link to the Issue Tracker:


  • Zack K.

    When I try load an app using fledgecontroller, sometimes it works and sometimes the simulator seems to simply ignore the commands. Any idea what causes this?

    I’m also having trouble loading applications from the menu: Sometimes when I try to load an app using File -> Load BlackBerry Application, the simulator shows the “busy” spinner, but the new app never appears in the menu.

    Any idea what I’m doing wrong?

  • Johney_red

    It doesn’t work for me. First, i get “cannot find file – .debug” error, and now, when I find that file, it seems to Debug-Restart doesn’t compile my code, it just run old one , again and again. How to resolve this?

blog comments powered by Disqus