Till now we discussed introduction to flex , how to create a project in flash builder? and setting compiler options in flash builder, and in this tutorial, we are going to discuss about how we can compile flex project without Flash builder? You may face situation like , if you are not using flash builder for creating your flex project then ‘how you will compile that?’
in one sentence we can say: we can use terminal window or command prompt to invoke the MXML compiler.
Compile flex project without Flash Builder
Although Flash builder is the most powerful tool for creating a flex project there may be some situation which forces us to compile flex projects without using Flash builder. So Flash builder is not necessary to compile Flex project. The MXML compiler (mxmlc) is free to use and can be downloaded from adobe site.
Where we can get the compiler-compile flex project without flash builder
To compile flex project without flash builder ,First get the mxmlc , for that you should download the adobe Flex SDK :
We can download the flex SDK from: http://www.adobe.com/products/flex/flexdownloads/
After downloading and extracting the Flex SDK, you can find mxmlc.exe in
For example, if you saved the SDK in C:\flex4sdk\, you will find the file in
And form running the flex mxmlc you need to install the java runtime environment that you can download from the following link:
Using Command line-compile flex project without flash builder
To compile flex project without Flash Builder, open a command prompt or terminal window, invoke the mxml compiler, and pass the file containing the application as an argument using a command such as the following :
home:base$. /Users/base/Flex SDK 4/bin/mxmlc ~/Documents/FlexTest/FlexTest.mxml
This will compile the MXML file into a SWF that by default resides in the folder where the MXML file is located. Any warnings or errors from the compiler will be displayed in the terminal or command-prompt window.
To add further options to the MXMLcompiler, you append arguments to the call to the compiler.
For example, this command:
home:base$ ./mxmlc ~/Documents/FlexTest/FlexTest.mxml-output=/Users/base/test/generated/Index.swf -library-path+=/Users/lib/MyLib.swc
generates a SWF file named Index.swf, places it in the directory at /Users/base/test/generated/, and includes the SWC library /Users/lib/MyLib.swc .
To invoke the MXML compiler directly from the command line without providing the full path to your SDK installation (which in this example is C:\flex_sdk_4), you will need to add the /bin directory the compiler resides into the Path systems variable. On a Windows machine, do the following:
Open System from control panel
Select the advanced tab
Click on Environment variables
Within the system variables grid , navigate to and double-click path.
In the variable value field , if the last character is not set to semicolon (;) enter a semicolon and then the path to the /bin folder within your Flex SDK installation directory.
With the path to the MXML compiler directory set, open command prompt navigate to your project directory, and enter the following command:
This generates the SampleTest.swf file within the SampleTest folder in your project directory.
If the previous step results in the following error message:
Error:Could not find JVM.
You must manually enter the path to the directory in which the java runtime environment is installed in your machine. To manually enter the path, navigate to the /bin directory of your Flex 4 SDK installation, opens the jvm.config file in a text editor , and append the path to your JRE installation directory to the variable java.home. Assuming the java installation is on the root of your drive, you would enter the following:
Now you have set the path to the Flex compiler.You are ready to compile flex project without flash builder!
Latest posts by Aravind Radhakrishnan (see all)
- Steps to install bootstrap 4 using npm in an angular 4 project | Angular 4 - September 13, 2017
- 3 useful Angular 2 developer tools | Angular 2 - October 27, 2016
- Easy way for creating mirrored bar chart | Zingchart - September 14, 2014