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
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,
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
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.
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 -Dsun.io.useCanonCaches=false
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.
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.
the useCanonCaches argument to false is
required to support Windows file names.