Package and launch an application from the command line

As an alternative to the IDE, you can package and launch the sample application from the command line.

To package and launch from the command line, you'll need to make sure you have Java installed: open a command prompt and type java -version and verify that it's version 1.6.x.

You can find the blackberry-nativepackager tool in the host usr/bin subfolder where you installed the Native SDK. To make it easier to run the blackberry-nativepackager tool, add the path to the usr/bin subfolder where you installed the Native SDK to the PATH environment variable for your operating system. For more information about command line options, run blackberry-nativepackager from the command line with no options.

To build, package, and launch from the command line:

  1. Download a sample application from http://developer.blackberry.com/playbook/native/sampleapps and unzip the downloaded archive to a folder on your host computer.
  2. Change to the folder containing the sample, and type the following, where native-sample is the name of your sample application:
    cd native-sampleMakefile 
  3. If you haven't already done so, type the following to set the environment variables used by the Native SDK command line tools. The location of bbndk-env will be different if you've chosen an installation folder other than the default.

    On Windows:

    \bbndk-2.0.0\bbndk-env.bat

    On Linux, if you installed the Native SDK as a root user:

    ./opt/bbndk-2.0.0/bbndk-env.sh

    On Linux, if you installed the Native SDK as a non-root user:

    ./home/usernamebbndk-2.0.0/bbndk-env.sh

    On Mac:

    ./Developer/SDKs/bbndk-2.0.0/bbndk-env.sh
  4. While still in the native-sampleMakefile directory, type make.
    You now have an application ready for packaging.
  5. To package your Native SDK application for a device, type this command (where native-sample is the name of your application, Playbook is the build configuration, and the \ indicates that the command needs to be typed on one line):
    blackberry-nativepackager -package native-sample.bar \
    bar-descriptor.xml -e Playbook/native-sample native-sample \ 
    native-sample.png
    You can change the binary from Device-Release/native-sample or Device-Debug/native-sample (the BlackBerry PlayBook tablet) to Simulator/native-sample to run the sample application on the simulator.
For more information on packaging from the command line, see Developing with the Native SDK.

.