Flex - Java - Oracle
Flex - Java - Oracle
us/confluence/display/Flex/Creating+a+Flex+Java+Oracle+Web+Applic
ation
Added by Tracy Olson, last edited by Kathleen Jones on Apr 09, 2010 (view change)
Included Materials
BasicFlexTutorial
IDE Software
BlazeDS\blazeds.war http://its.adfg.state.ak.us/BasicFlexTutorial/IDE
%20Software/BlazeDS/blazeds.war
eclipse-jee-ganymede-SR2-
win32.zip http://its.adfg.state.ak.us/BasicFlexTutorial/IDE%20Software/eclipse-jee-
ganymede-SR2-win32.zip
Ojdbc14.jar http://its.adfg.state.ak.us/BasicFlexTutorial/IDE
%20Software/ojdbc14.jar
ConnectionHelper.java http://its.adfg.state.ak.us/BasicFlexTutorial/Flex
%20and%20Java%20code/ConnectionHelper.java
DummyData.as http://its.adfg.state.ak.us/BasicFlexTutorial/Flex
%20and%20Java%20code/DummyData.as
DummyDataDTO.java http://its.adfg.state.ak.us/BasicFlexTutorial/Flex
%20and%20Java%20code/DummyDataDTO.java
DummyDataVO.as http://its.adfg.state.ak.us/BasicFlexTutorial/Flex
%20and%20Java%20code/DummyDataVO.as
DummyDataVO.java http://its.adfg.state.ak.us/BasicFlexTutorial/Flex
%20and%20Java%20code/DummyDataVO.java
haida-
salmon.jpg http://its.adfg.state.ak.us/BasicFlexTutorial/Flex%20and
%20Java%20code/haida-salmon.jpg
Software Requirements
http://java.sun.com/javase/downloads/index.jsp
http://www.eclipse.org/downloads/download.php?
file=/technology/epp/downloads/release/ganymede/SR2/eclipse-jee-ganymede-SR2-win32.zip
http://www.adobe.com/cfusion/entitlement/index.cfm?e=flexbuilder3
If you have not purchased a license for Flex there is a 60 trial.
http://tomcat.apache.org/download-60.cgi
Note: ojdbc14.jar must be placed into Tomcat’s lib folder. Tomcat doesn’t include this jar. It is most likely
already in your machine somewhere. Do a search for it or download it from here
http://opensource.adobe.com/wiki/display/blazeds/download+blazeds+3
Oracle Database
I created a user account specifically for this tutorial. You should be able to access it without
additional software.
Installing Software
If you acquire the software on your own, pay attention to where you install everything. Where the software
is saved/installed does not matter as long as you point Eclipse in the right direction. Should you use the
files I included with this tutorial, place each folder directly into c:\. Otherwise the paths I specify in my
tutorial will be different from your paths. It is important to install the software in the order listed below.
Eclipse – Unzip the root folder where you want. There is no install process.
Flex Builder 3 – Follow the install wizard. When installing the plug-in it will ask you which Eclipse IDE you
wish to install the Flex.
When you reach the part that asks for Administrator Login leave everything at the default and
click next.
It asks you for a path to Java 5. The text field should default to your Java 6 path C:\Program
Files\Java\jre6. Click install.
Defaults to C:\Program Files\Apache Software Foundation\Tomcat 6.0
OJdbc14.jar - Copy and paste ojdbc14.jar into your Apache Tomcat lib folder
Creating a Workspace
Step 1.
Step 2.
File -> Switch Workspace
Browse to c:\FlexTutorialWorkspace
Click OK
Eclipse will close and reopen.
Click the Workbench icon. (Furthest right icon. Curved Arrow.)
Step 1.
Step 2.
Step 3.
Navigator pane: Right click java_src -> New -> Other -> Java -> Package
Name: enter “gateway”
Click Finish
In the Navigator pane, highlight gateway
Select File -> New -> Other -> Java -> Class
Name: enter "DummyDataVO"
Leave all other entries as they are
Click "Finish"
(Repeat for classes DummyDataDTO and ConnectionHelper).
Copy and Paste or type in the files:
DummyDataVO.java
DummyDataDTO.java
ConnectionHelper.java
Note: I removed the username and password from the code.
Contact [email protected] for the information.
Resulting Directory Structure
BasicFlexTutorial
.settings
bin-debug
bin-release
flex_libs
flex_src
assets
haida-salmon.jpg
data
DummyDataVO.as
script
DummyData.as
BasicFlexTutorialMain.mxml
html-template
java_src
gateway
DummyDataDTO.java
DummyDataVO.java
ConnectionHelper.java
WebContent
META-INF
WEB-INF
flex
lib
src
web.xml
.actionScriptProperties
.classpath
.flexproperties
.project
Servers
.settings
Tomcat v6.0 Server at localhost-config
.project Setting up the Server (running app locally)
Step 1.
Step 2.
Step 3.
Step 4.
Start server
Server pane: Double-click Tomcat v6.0 Server at localhost
Click "Use Tomcat installation ..." (second radio button)
CTRL-S to save
Close Overview tab
Step 5.
Stop Server
Right-click Servers Tab
Select Add and Remove Projects...
Highlight BasicFlexTutorial
Click Add >
Click Finish
Step 6.
Start server
Step 7.
Select BasicFlexTutorialMain.mxml
Run -> Run As -> Flex Application
The green circle with a white triangle is the run button. Note: To compile/build every time
you save. Select Project -> Build Automatically
Step 1.
Step 2.
Step 3.
Step 4.
In Mozilla, goto http://its.adfg.state.ak.us:8195/
Select Tomcat Manager
For username & password: Contact [email protected]
Step 5.
Step 6.
Step 7.
SVN (Subversion) - When using SVN be sure to point the Flex compiler to the local copy of the project
you checked out.
Port Error - If you try to start your server from within Eclipse and get an error saying all the ports are in
use you need to close Eclipse and reopen it. Remember to save any changes first.
Java 5.0 Update 22 (Java SE Development Kit 5.0u22) - If you want to use Java 5.0 you can get it here.
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-
Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jdk-1.5.0_22-oth-JPR@CDS-
CDS_Developer
Converting JRE 6.0 to JRE 5.0 (Vice Versa) - To move from one version of java to the other you must
change the Java Build Path, Java Compiler and Project Facets. These steps explain how to go from 6 to
5. Going from 5 to 6 is the same. Be sure that you have installed the JDK you want to use.