MATLAB Runtime Server    

Automatically Packaging Files for Shipping

The Runtime Server software includes a packaging utility that can automatically archive your application files and create all the executable files that your users need in order to install your application on their machines.

The packaging utility is called package and is located in the toolbox\runtime\oem directory. When you execute package, it prompts you for all necessary information. It reports all relevant information to you, including the files it creates and the instructions that you should follow in order to test the installation. These are the same instructions that end users need to follow in order to install your application. Installing and Running the Application contains more information about the installer software.

The rest of this section contains more detail for PC and UNIX versions of package.

Packaging Utility on PC

After you have used buildp to create your P-files, follow these steps to run the automatic packaging utility on PC platforms:

  1. Use makeconfig to create a configuration file, which is a text file that lists the names of all files that your application uses. This file includes runtime P-files and any MEX-files on which your application depends. It should not include MATLAB and files that MATLAB uses to run.

  1. A sample configuration file is toolbox\runtime\oem\user.config_pc. Notice from the sample user.config_pc file that the path of each listed file starts from toolbox (for example, toolbox\local\matlabrt.p).

    The configuration file can contain * as a wildcard, # to preface comments, and blank lines to improve readability.

  1. Go to the system prompt and navigate to the toolbox\runtime\oem directory. Run the packaging utility using one of the commands below.
  1. package (if your application does not use Java classes)

    package -java (if your application uses Java classes)

    The packaging utility prompts you for:

    1. The path to your stamped MATLAB root directory
    2. The path of your configuration file
    3. A name for your application. This is the name of the batch file that the automatic installer creates when your end users install your application. If you do not specify a name, then the batch file is called demo_app.bat.

    Alternatively, the syntaxes below eliminate the need for prompts.

    package -r matlabroot -c config_file -n app_name

    package -java -r matlabroot -c config_file -n app_name

The packaging utility produces a file called setup.exe in the directory from which it was launched. This is the file you should ship to end users.

Packaging Utility on UNIX

After you have used buildp to create your P-files, follow these steps to run the automatic packaging utility on UNIX platforms:

  1. Use makeconfig to create a configuration file, which is a text file that lists the names of all files that your application uses. This file includes runtime P-files and any MEX-files on which your application depends. It should not include MATLAB and files that MATLAB uses to run.

  1. A sample configuration file is toolbox/runtime/oem/user.files. The format for lines in this configuration file is

    name_of_source_file   location_of_source_file   target_location

    where target_location refers to the destination directory in the end user's installation, relative to the directory from which the user runs the installer program.

    In your configuration file, you can use $SCRIPTDIR to indicate the directory location of the package script and $MATLAB to indicate the MATLAB root directory. You can also use Bourne shell wildcards in filenames.

  1. Run the script
  1. toolbox/runtime/oem/package

    using the -java switch if your application uses Java classes. The script prompts you for the MATLAB root directory, the architecture, and the name of your configuration file.

    For information on command line arguments you can use to prevent prompting while running the package utility, see

    package -help

The package script produces two files:

You should ship app.tar to end users. For more details about the UNIX packaging utility, see the README file in toolbox/runtime/oem.


  Organizing Files for Shipping Manually Packaging Files for Shipping (PC)