How to Launch an AIR Application from the Command Line

These days, desktop applications are usually launched either from the Windows Shell, Mac OS Finder, KDE Desktop, etc. Less well-known is that these operating systems all also allow applications to be launched directly from the command line, terminal, DOS prompt, etc. When launched from the command line, applications can also receive command line arguments.

Consistent with our goal of making AIR-based applications as much like regular desktop applications as possible, this also works for AIR-based applications. In AIR, those command line arguments are received via the InvokeEvent dispatched from NativeApplication. This can prove useful in a variety of situations, especially when writing scripts for testing or other automated work.

On Windows and Linux, invoking AIR-based applications at the command line is straightforward. On Windows, inside the application’s install directory you’ll find an executable with the application’s name; that’s the thing to run from the command line. On Linux, the executable is inside the “bin” subdirectory.

On Mac OS things are slightly trickier. In Finder, applications appear to be a single file, but they’re really a folder with with an extension of “.app” and a particular interior folder structure. To launch them from the command line with arguments, you have to dig into this structure and find the executable. For example, to launch an application named HelloWorld you’d run:


You can also run an application on Mac OS via the “open” command, but open doesn’t support passing any command line arguments to the application.

One final note: You can also pass arguments to your application when debugging with adl. However, since adl takes its own arguments as well, you need to separate the adl arguments from the arguments intended for the application with the double-dash argument, like so:

adl HelloWorld-app.xml — a b c

In this example, the application will receive an InvokeEvent with arguments a, b, and c.