Installing the Flex Builder Plug-In Flex Builder Can Be Installed in Two Fashions: As a Stand-Alone IDE Or As a Plug-In to Eclipse
Total Page:16
File Type:pdf, Size:1020Kb
APPENDIX ■ ■ ■ Installing the RIA Tools Platform Throughout this book, you’ll see that several tools are necessary to produce RIAs. These include Apache Tomcat, Eclipse, Flex Builder, MySQL, and Blaze DS. Most of these tools are essential to the development process for RIAs and Spring applications. The only tool that is commercial is Flex Builder, and I present alternative command-line options to create and compile your Flex source code. The other tools are free; most are fully open source. This appendix describes how to install the tools platform I use to develop RIAs and Spring applications. Of course, it’s up to you to decide what you need for developing your own projects. You can replace any of the tools described here with corresponding ones that you prefer. Remember that the goal is to be as efficient as possible when delivering your high-quality applications. Installing Apache Tomcat I used Tomcat 5.5.x to run the examples in this book. Tomcat 5.5 requires Java 5 or later. Follow these steps to install Tomcat on your desktop or server: 1. Download Tomcat from http://tomcat.apache.org/download-55.cgi. 2. Download the latest version of the Core distribution, in either .zip or tar.gz format. 3. Extract the archive to your hard drive. If you download the .zip file, you will need to extract its contents to a location of your choice and run the executable tomcat4w.exe. This won’t install Tomcat as a service. I suggest using the installer if you are setting up a server that needs a service running. If you are installing with the zip distribution, you will not go through the next steps. You will be required to edit the conf\ tomcat-users.xml file to set the admin username and password. The default server runs on port 8080 in both installations. 4. Double-click the installer (apache-tomcat-5.5.x.exe). 5. Click Next on the splash screen that comes up in the installer. 6. Click I Agree on the next screen. 435 436 APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM 7. Choose the components you want to install to your server, as shown in Figure A-1. If you want Tomcat to run as a service, check that box so it will be started automatically when the server boots. Figure A-1. Choosing the components to install with Tomcat 8. Choose an install location on your local file system. 9. Set up the HTTP connection port and administrator login username and password, as shown in Figure A-2. Figure A-2. Setting the Tomcat basic configuration APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM 437 10. Set the path of your Java Virtual Machine (Java 5 or later install location), as shown in Figure A-3. Figure A-3. Setting the Java Virtual Machine location Now you are ready to start hosting web applications on your Tomcat server. Installing Eclipse For the examples in this book, I used the Eclipse Classic 3.4.1 distribution. Follow these steps to download and install Eclipse: 1. Download the version of Eclipse for your development platform (Windows, Linux, or Mac OS X) from http://www.eclipse.org/downloads/. You may also want to download the Eclipse IDE for Java EE Developers, which comes with web application plug-ins that help with enterprise Java development. 2. Accept the default mirror or choose another that may be faster (based on proximity). 3. Download the distribution and unzip it to your local file system. 4. Find the eclipse.exe file and run it. You can select the default workspace location or create a completely new one to keep your projects categorized. You are now ready to run Eclipse and start coding away. 438 APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM Installing MySQL and GUI Tools For the projects in this book, I used MySQL 5.0 Community Server. MySQL comes with two distributions: the database installation and the GUI Tools to support the database. Follow these steps to install MySQL: 1. Download MySQL Community Tools for the database server from http://dev.mysql.com/ downloads/mysql/5.0.html. 2. Extract the MySQL Community Server database installation to a directory of your choice. 3. Double-click the executable to run it. 4. Click Next at the first screen in the Setup wizard. 5. In the next screen, select the type of installation you want to perform: Typical, Complete, or Custom. I chose Custom for the database installation I used for the examples in this book. 6. In the Custom Setup screen, choose the items you wish to install, as shown in Figure A-4. Click Next to continue. Figure A-4. MySQL custom setup APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM 439 7. The next screen indicates the install directory for MySQL, as shown in Figure A-5. Click the Install button to proceed with the installation. Figure A-5. MySQL destination folder Once the installation is complete, you will be allowed to configure your MySQL server. I accepted the defaults presented by the wizard, and set the root password for the server. This installed MySQL as a service, ready for tables to be built. To install the GUI Tools for MySQL, download the installer from http://dev.mysql.com/ downloads/gui-tools/5.0.html. Then double-click the executable to run it. I accepted the defaults for a custom installation, and installed the MySQL Query Browser and MySQL Administrator, as shown in Figure A-6. These tools are very visual and will help you build and configure your databases quickly. 440 APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM Figure A-6. MySQL Tools selection Installing the Flex Builder Plug-In Flex Builder can be installed in two fashions: as a stand-alone IDE or as a plug-in to Eclipse. I prefer to install the plug-in to Eclipse, since Eclipse comes with all of the Java development components I need. You must have Eclipse 3.3 or higher installed to use the Flex Builder plug-in. Follow these steps to install the Flex Builder plug-in for Eclipse: 1. Download the Adobe Flex Builder Eclipse plug-in installation from http:// www.adobe.com/products/flex/flexdownloads/#flex_builder. 2. Run the executable for Flex Builder by double-clicking it. 3. In the first installer screen, click Next. 4. Accept the license agreement and click Next. 5. You will be presented with a screen to choose your install location, as shown in Figure A-7. Accept the default or choose another location, and then click Next. APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM 441 Figure A-7. Flex Builder install folder selection 6. The next screen asks you to choose an existing Eclipse location, as shown in Figure A-8. The Flex Builder plug-in will be integrated with this Eclipse installation. Click Next to continue. Figure A-8. Eclipse folder selection 7. Click the Install button to install the Flex Builder plug-in. 442 APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM Installing the Flex SDK The Flex SDK is required for command-line compiling of your applications. To install the Flex SDK, follow these steps: 1. Download the Flex SDK from http://www.adobe.com/products/flex/flexdownloads/ #flex_builder. 2. Extract the contents of the Flex SDK zip file to a location of your choice, where you will reference the Flex command-line utilities in the bin folder of the Flex SDK installation. 3. You also need access to the Flex compiler, mxmlc. Add the operating system environment variable to the path. For example, the following path entry is where I have the Flex SDK installed: Path=C:\Program Files\Adobe\flex_sdk_3\bin 4. Test that you have access to the Flex compiler. From the command line, type mxmlc and press Enter. You should get the following results: C:\mxmlc Adobe Flex Compiler (mxmlc) Version 3.1.0 build 2710 Copyright (c) 2004-2007 Adobe Systems, Inc. All rights reserved. mxmlc [options] [defaultVar] Use 'mxmlc -help' for more information. With these steps complete, you can now use the Flex SDK to compile your Flex applica- tions in combination with Ant. Installing Ant You can use Ant to compile your Flex application source code. Follow these steps to use Ant for Flex projects: 1. Download Ant from http://ant.apache.org. 2. Install Ant by moving the contents of the zip archive to the directory of your choice on your workstation. 3. Add the Ant bin directory to your operating systems environment variables in system variables. Path=C:\apache-ant-1.7.1\bin APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM 443 4. To check that you have Ant installed correctly with the path set, open a command-line terminal and enter ant. You should see something like this: C:\ant Buildfile: build.xml does not exist! Build failed If you get this message, you successfully have Ant installed and ready to build your Flex applications. Building Flex Applications with Ant As an alternative to using the commercial Flex Builder application, you can use the Ant script in Listing A-1 to build your Flex applications. The build.xml file needs to be located in the root directory of your Flex project. Listing A-1. A build.xml Ant Script to Build Flex Applications <?xml version="1.0" encoding="utf-8"?> <project name="YourProjectNameHere" basedir="."> <property name="FLEX_HOME" value="C:\Program Files\Adobe\flex_sdk_3"/> <taskdef resource="flexTasks.tasks" classpath= ""${FLEX_HOME}/ant/lib/flasTasks.jar"/> <property name="APP_ROOT" value="src"/> <property name="OUTPUT_DIR" value="bin" /> <property name="APP_NAME" value="YourAppNameHere" /> <target name="init"> <delete dir="${OUTPUT_DIR}" /> <mkdir dir="${OUTPUT_DIR}" /> </target> <target name="wrapper"> <html-wrapper title="Flex Ant Compile" file="${APP_NAME}.html" height="300" width="400" bgcolor="red" application="app" swf="${APP_NAME}" version-major="9" version-minor="0" version-revision="0" history="true" template="express-installation" output="${OUTPUT_DIR}"/> </target> 444 APPENDIX ■ INSTALLING THE RIA TOOLS PLATFORM <target name="main" depends="init,wrapper"> <mxmlc file="${APP_ROOT}/${APP_NAME}.mxml" output="${OUTPUT_DIR}/${APP_NAME}.swf" keep-generated-actionscript="true"> <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/> <source-path path-element="${FLEX_HOME}/frameworks"/> <!-- Access to all SWC files in the project libs directory.