Package your application from the command line

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.

  1. Open a command prompt.
  2. Navigate to the folder where your SWF application and XML configuration files are stored.
  3. Type the following command to package your application:
    blackberry-nativepackager [<commands>] [<options>] bar-package [app-desc  files]

    Variables:

    bar-package
    a path for the output BAR file
    app-desc
    a path to the application descriptor file (bar-descriptor.xml)
    files
    paths to files or directories to include in a package.
    These paths can be absolute or relative to a current directory. The resulting location in the package is a tail path of the file, unless overridden by the -C or -e options.

    Commands:

    -package
    package assets into a unsigned BAR file (default)
    -installApp
    install the package
    -launchApp
    launch the application (without installing)
    -list
    list all files in the resulting package (for debugging of packaging issues)
    -listManifest
    print BAR manifest (for debugging of packaging issues)
    -installDebugToken
    install debug token to the device
    -generateDebugToken
    request and generate new debug token using device PIN
    -renewDebugToken
    request and generate debug token using PIN from existing token, replacing it
    -sign
    sign the package for publishing (requires an Internet connection)

    Packaging options:

    -target format
    specify a target format, either bar or bar-debug. Debug format implies a debugger connection on startup.
    -buildId ID
    set the build ID (the fourth segment of the version). Must be a number from 0 to 65535
    -buildIdFile file
    set the build ID from an existing file, save new incremented version to the same file
    -devMode
    package in development mode; required to run unsigned applications and access application data remotely
    -debugToken token
    use debug token credentials to generate author and authorId (only usable with -devMode.

    Signing options:

    -keystore store
    specify a path to a keystore file, default is C:\Users\user\.keystore
    -storepass password
    specify the password for the certificate store

    Path options:

    -C dir
    use dir as a root directory. All files that follow will be used with tail paths in the final package.
    -e file path
    save a file with the specified path in the package

    Deployment options:

    -device deviceId
    specify the IP address of the target
    -password password
    specify the device password

    Other options:

    -version
    print version
    help-advanced
    print advanced options
    -help
    print the usage information

    You can also specify the options and commands in a file, with one command-line argument per line by using the @ options_file option.

Example 1:

blackberry-nativepackager -package out.bar -devMode bar-descriptor.xml mybinary -C /tmp /tmp/locale/
This example creates a development BAR file (out.bar) in the /tmp directory with assets mybinary and /locale.

Example 2:

blackberry-nativepackager -package out.bar -buildId buildId.txt -sign -storepass 123456 bar-descriptor.xml mybinary icon.png
This example creates a signed BAR file (out.bar) for publishing with assets mybinary and icon.png.