New Code Hot Swap Feature with BlackBerry Simulators

How-to

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 BlackBerry.ee 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 works on the Developer Relations team at BlackBerry, focusing on WebWorks, HTML5, and Open Source.

Join the conversation

Show comments Hide comments
+ -
blog comments powered by Disqus