# Packaging the app into a BAR file from Qt Creator

After defining the app descriptor file, you can generate a BAR file that contains the app's binary and icon file. The BAR package will be used by the target system to install the app.

These instructions show how to produce a BAR file as a custom build step in Qt Creator, but you can also generate a BAR file from the command line. BAR files are created by the blackberry-nativepackager tool, which is part of the QNX SDK for Apps and Media installation on your host system.
To package the app into a BAR file from Qt Creator:
1. Click the Projects icon on left side, select the Build & Run tab, click Add Build Step, then select Custom Process Step:
2. On the line that reads Command, click Browse....
3. In the file selector dialog, navigate to DEFAULT_SDP_PATH\host\win32\x86\usr\bin and choose blackberry-nativepackager.bat (on Windows) or navigate to DEFAULT_SDP_PATH/host/linux/x86/usr/bin and choose blackberry-nativepackager (on Linux).
4. On the line that reads Arguments, enter:
QtApp.bar %{sourceDir}\bar-descriptor.xml QtApp –C %{sourceDir} %{sourceDir}\icon.png


These arguments tell the packaging utility to create a file named QtApp.bar using the information in bar-descriptor.xml and to include QtApp (the binary) and icon.png in the root folder of the BAR file. For the list of all command options applicable to Qt apps, see .

This step makes Qt Creator run the blackberry-nativepackager command as a build step. Every time you recompile the application, the binary is repackaged into a BAR file.

5. Scroll down to the Build Environment section, locate the Use System Environment entry, then click Details (on the right side).
6. In the list of environment variables, locate PATH and if necessary, add the path to the host system's java.exe location to the variable's value.

You can modify the variable's value by clicking the variable name in the display area, clicking Edit in the upper right area, and then entering the new value.

The Qt Creator build environment must be configured to find java.exe because the blackberry-nativepackager command runs a batch file that calls a Java program.

7. Click the Edit icon on the left side to return to the editing view, select the Build menu, then choose Build Project "QtApp".

Qt Creator builds the QtApp project by compiling the UI-defining QML file into the binary, then generates the BAR file by running the configured packaging command. The IDE displays timestamped messages detailing the outcomes of the build steps in the Console Output window.

The QtApp app is packaged in a BAR file and can now be deployed on your target system.