---
title: "Flex与Java的交互1---工程构建"
author: "gu6866"
date: "2012-07-21T18:53:40Z"
tags: []
categories: ["Web前端"]
slug: "flex-java-1"
draft: false
lastmod: "2012-07-21T18:53:40Z"
id: 1602764
url: "https://premier9527.iteye.com/blog/1602764"
---

flex与java的交互：

1.创建一个web project--helloFlex

2.配置Blazeds:下载最新的Blazeds,解压内部的blazeds.war文件，拷贝WEB-INF目录内的下列内容到helloFlex/WEB-INF:    flex目录、lib目录、web.xml文件、src目录

3.将helloFlex/WEB-INF下的src目录改名为flex\_src

4.向helloFlex添加flex项目类型：  
  在helloFlex上右键-&gt;Add/Change Project Type-&gt;Add Flex Project Type  
  在弹出的对话框中选择Flext4.5,点击Next  
  填写配置：根文件夹: web project/WebContent  
            根url: [http://localhost:8080/helloFlex](http://localhost:8080/helloFlex)  
            上下文根目录：helloFlex  
            输出文件夹：WebContent  
  点击Finish，切换到Flash视图,工程编译后会提示没有生成包装页错误，按以下步骤重新生成包装页：  
  更改Flex源文件目录为flex\_src  
  右键工程-&gt;属性-&gt;Flex构建路径-&gt;主源文件夹  
  移动helloFlex.mxml文件到上述目录

5.运行,在Server视图中将helloFlex添加到tomcat服务器，并启动。  
  访问地址：[http://localhost:8080/helloFlex/helloFlex.html](http://localhost:8080/helloFlex/helloFlex.html)