SDK configuration

Use the configuration files included with Adobe® Flex® SDK to configure the compilers and other aspects of Flex.

About configuration files

Root variables

For Flex SDK, the flex_install_dir variable is the top-level directory where you installed the SDK. Under this directory are the bin, frameworks, lib, and samples directories. The flex_app_root directory is the top level location for many files.

Configuration files layout

The layout of the configuration files for Flex SDK is simple. It includes a jvm.config file, fdb command-line debugger shell script, and the mxmlc and compc command-line compiler shell scripts for configuring the JVM that the compiler uses. It also includes the flex-config.xml file that sets the compiler options, as well as executable files for fdb, mxmlc, and compc.

The layout of the configuration files for Flex SDK is as follows:


Flex SDK configuration

Flex SDK includes the mxmlc and compc command-line compilers. You use mxmlc to compile applications from MXML, ActionScript, and other source files. You use the compc compiler to compile component libraries, Runtime Shared Libraries (RSLs), and theme files.

The compilers are located in the sdk_install_dir/bin directory. You can configure the compiler options with the flex-config.xml file or command line options.

The compilers use the Java JRE. As a result, you can also configure settings such as memory allocation and source path with the JVM arguments.
Note: You must use a 32-bit version of the JDK, version 1.5 or later. The command line compilers do not work with a 64-bit JDK.

Command-line compiler configuration

The flex-config.xml file defines the default compiler options for the compc and mxmlc command-line compilers. You can use this file to set options such as debugging, SWF file metadata, and themes to apply to your application. For a complete list of compiler options, see Using mxmlc, the application compiler and Using compc, the component compiler.

The flex-config.xml file is located in the sdk_install_dir/frameworks directory. If you change the location of this file relative to the location of the command-line compilers, you can use the load-config compiler option to point to its new location.

You can also use a local configuration file that overrides the compiler options of the flex-config.xml file. You give this local configuration file the same name as the MXML file, plus “-config.xml” and store it in the same directory. For example, MyApp-config.xml. When you compile your MXML file, the compiler looks for a local configuration file first, then the flex-config.xml file.

For more information on compiler configuration files, see About configuration files.

JVM configuration

The Flex compilers use the Java JRE. Configuring the JVM can result in faster and more efficient compilations. Without a JVM, you cannot use the mxmlc and compc command-line compilers. You can configure JVM settings such as the Java source path, Java library path, and memory settings.

You must use JDK 1.5 or later with the command-line compilers. These compilers are 32-bit executables and cannot launch 64-bit processes. As a result, they require a 32-bit version of Java to run. If you have both a 32-bit and 64-bit JDK installed, you can use several techniques to target the 32-bit version for compilation, including:
  • Using the JAVA_HOME environment variable to point to the 32-bit version of the JDK when you compile with mxmlc or compc

  • Modifying the Flex SDK’s jvm.config file to point to the 32-bit version of the JDK

  • Using batch files that point to the 32-bit version of the JDK to launch the compilers

On Windows, you use the compc.exe and mxmlc.exe executable files in the bin directory to compile Flex applications and component libraries. You use the fdb.exe executable file in the bin directory to debug applications. The executable files use the jvm.config file to set JVM arguments. The jvm.config file is in the same directory as the executable files. If you move it or the executable files to another directory, they use their default settings and not the settings defined in the jvm.config file.

The fdb, compc, and mxmlc shell scripts (for UNIX, Linux, or Windows systems running a UNIX-shell emulator such as Cygwin) do not take a configuration file. You set the JVM arguments inside the shell script file.

The jvm.config file is used by the Java process opened by the mxmlc and compc command-line executable files. The file is located in sdk_install_dir/bin.

Changing the JVM heap size

The most common JVM configuration is to set the size of the Java heap. The Java heap is the amount of memory reserved for the JVM. The actual size of the heap during run time varies as classes are loaded and unloaded. If the heap requires more memory than the maximum amount allocated, performance will suffer as the JVM performs garbage collection to maintain enough free memory for the applications to run.

You can set the initial heap size (or minimum) and the maximum heap size on most JVMs. By providing a larger heap size, you give the JVM more memory with which to defer garbage collection. However, you must not assign all of the system’s memory to the Java heap so that other processes can run optimally.

To set the initial heap size on the Sun HotSpot JVM, change the value of the Xms property. To change the maximum heap size, change the value of the Xmx property. The following example sets the initial heap size to 256M and the maximum heap size to 512M:

java.args=-Xms256m -Xmx512m

In addition to increasing your JVM’s heap size, you can tune the JVM in other ways. Some JVMs provide more granular control over garbage collecting, threading, and logging. For more information, consult your JVM documentation or view the options on the command line. If you are using the Sun HotSpot JVM, for example, you can enter java -X or java -D on the command line to see a list of configuration options.

In many cases, you can also use a different JVM. Benchmark your Flex application and the application server on several different JVMs. Choose the JVM that provides you with the best performance.

Setting the useCanonCaches argument to false is required to support Windows file names.

Flash Player configuration

You can use the standard version or the debugger version of Adobe® Flash® Player as clients for your Flex applications. The debugger version of Flash Player can log output from the trace() global method as well as data services messages and custom log events.

You enable and disable logging and configure the location of the output file in the mm.cfg file. For more information on locating and editing the mm.cfg file, see Editing the mm.cfg file.

You can configure the standard version and the debugger version of Flash Player to use auto-update and other settings by using the mms.cfg file. This file is in the same directory as the mm.cfg file. For more information on auto-update, see the Flash Player documentation.