Skip navigation
Home/Support/

Forums

812 Views 8 Replies Latest reply: Apr 23, 2010 2:29 PM by Ansury RSS
pr1440 Calculating status... 9 posts since
Mar 9, 2010
Currently Being Moderated

Mar 9, 2010 5:13 PM

Eclipse setup JAVA/Flex

What are the steps within Eclipse to create a Flex web page so when I click a button I connect via JAVA to the database I get the data...

 

like this example,

http://www.adobe.com/devnet/livecycle/articles/blazeds_testdrive_04.ht ml

 

I am trying to develop, deploy this exact example from within Eclipse and I am confused.  I switch to the Java view for java development, next I switch to Flex in a NEW project for Flex development...then "Run" and point to the Workspace of the JAVA project...

 

Is this the best approach?

 

Thank you,

Pete

  • Ansury User 1,541 posts since
    Aug 5, 2007
    Currently Being Moderated
    1. Mar 10, 2010 9:42 PM (in response to pr1440)
    Re: Eclipse setup JAVA/Flex

    A few different ways of doing this and I'm not sure I've settled on a "best" way yet.  That example uses that Blaze 'turnkey' thing.. meh.  I think it kinda dumbs things down and distracts from how to really get started.

     

    You could create a "combined" Java/Flex project by:

    -Installing the Flex Builder plugin for Eclipse (But oops - doesn't seem to be compatible with the latest version with EE support! At least, it refused to install when I tried it.  I believe it complains about a missing "configuration" folder when it's clearly not missing...)

    -Installing Flex Builder standalone and pulling in WTP to create the same type of project.

    http://corlan.org/2008/06/05/creating-a-combined-flexjava-project-in-f lex-builder-wo-lcdsblazeds/

    I would give this link a try first.  (Unless you're developing in a secure/offline environment, then maybe not since it complicates things.)

     

    This will create a project with your Flex and Java source/libs at the same level.  I'd give this a shot first and see how you like it.  If you find that you keep getting "mixed up" when switching to/from Flex and Java perspectives (a problem I still am trying to break the habit of), you might want to consider a different project structure.  This option is probably Adobe's more recommended method I assume since their IDE supports it directly, but it's more "invasive" into your Java environment, say if you wanted to replace Flex with something else but keep your Java code (can't imagine why you'd want to do this though ).

     

    A second option is to install Eclipse and Flex Builder standalone separately.  Create your Java project, and then create your Flex client project inside the Java project (they can't be in the same folder because files like .project will conflict of course).  This requires you to do a little thinking about how you're doing your builds (use the Flex ant tasks) but has some subtle advantages which I won't go into too much.  One is that your "Java guys" don't need to have Flex Builder installed at all and can work with just (free) Eclipse.  This is probably the most flexible option but you do need to be prepared to work out solutions to minor issues such as where to put services-config.xml.  (It belongs in the Java project's WEB-INF/flex folder, but I know of no way for the Flex project to refer to it since it's outside the project.  My solution was to eliminate the dependency, i.e. by creating channels dynamically via ActionScript or a ChannelSet tag.)

     

    A third option which I've never really tried (but heard about from someone who didn't like it too much) would be to create two totally separate projects (not embedding one in a folder within the other), and then figure out a way to link the two projects together for purposes of building your war file.  If you like running Ant from a command line as some people do (I don't) this might work fine, but I don't think it'd be so nice building with Ant from Eclipse.  Just throwing this out there since who knows, it may work out better in someone's environment... maybe if migrating a Flex client's back end from something to Java, or developing multiple types of 'back end' architectures for the same client.

  • jake_flex User 159 posts since
    Apr 1, 2009
    Currently Being Moderated
    3. Mar 15, 2010 2:32 AM (in response to pr1440)
    Re: Eclipse setup JAVA/Flex

    Ansury gave quite a good response already, I'll just add some of my personal experiences.

     

    I have one app where the client (Flex) and the server (Java EE) and two completely different projects on the Flex Builder. Works just fine, When modifying the Java parts, Eclipse will automatically compile and deploy the source to the Tomcat. The client part works in a similar way, I can run and debug the code inside Eclipse. The problem here is that when debugging the application, the swf is not inside the war. For the release build we have an ant script that creates a deployable war file out the two. This scenario has the problem that the programming environment and the release environment are not identical, so we need also a test environment which is identical to the release environment (well we'd probably need the test environment anyway, so maybe it's not such a big problem)

     

    On another app I have one ant script compiles everything and even deploys it to Tomcat. I have configure Eclipse to use the build.xml automatically. This is nice and works well, but requires some more work to be set up. Good thing about this is that it's not IDE dependant. As one more downside, it requires an additional debugger.

     

    For the second project I tried the combined Java/Flex project setup, but that seemed like a real hassle, so I went with the ant approach.

     

    Hope this helps you to make your decisions.

  • Removable Eye Calculating status... 1 posts since
    Apr 23, 2010
    Currently Being Moderated
    5. Apr 23, 2010 9:57 AM (in response to pr1440)
    Re: Eclipse setup JAVA/Flex

    Ansury,

     

    You mentioned that you are using Eclipse with a Flex plugin. I haven't been able to find a Flex 4 plugin. Where did you find the Flex 4 plugin to use with Eclipse?

     

    I'm new to all of this if the answer if obvious.

     

    Thanks-in-advance

  • Ansury User 1,541 posts since
    Aug 5, 2007
    Currently Being Moderated
    7. Apr 23, 2010 2:18 PM (in response to Removable Eye)
    Re: Eclipse setup JAVA/Flex

    Removable Eye wrote:

     

    Ansury,

     

    You mentioned that you are using Eclipse with a Flex plugin. I haven't been able to find a Flex 4 plugin. Where did you find the Flex 4 plugin to use with Eclipse?

     

    I'm new to all of this if the answer if obvious.

     

    Thanks-in-advance

     

    If you want to try the Flex Builder plugin (actually I guess it's a 4th option) it should still be a choice when you install as usual from your FB CD.  In my experience however you can run into compatibility issues with later versions of Eclipse.

     

    Myself, though, I'm not using the plugin now.  Perhaps it's just me but I keep going back to having standalone Eclipse and Flex/Flash Builder installs, and simply putting the Flex client project inside the Eclipse project.  (Described above as the "second option".)  Perhaps I should change my recommendation to that option instead.  The only point of complication is services-config.xml, but nowadays there are a number of people using various methods to eliminate the services-config dependency.

     

    I don't recall any major problems with option 1 above, so it's probably just a matter of preferences (one of my dev environments is secure/offline, greatly complicating option 1) and your work environment/requirements.

  • Ansury User 1,541 posts since
    Aug 5, 2007
    Currently Being Moderated
    8. Apr 23, 2010 2:29 PM (in response to jake_flex)
    Re: Eclipse setup JAVA/Flex

    jake_flex wrote:

     

    I have one app where the client (Flex) and the server (Java EE) and two completely different projects on the Flex Builder.

     

    A good addition, this is a detailed account of the third option I presented above.  Personally I still like being able to have a single project in SVN source control (rather than 2 distinct projects), but it's a preferences thing.  When you're working with Java-only guys, you have to make sure they remember to update the Flex client code too, if it's embedded in the project, it's harder to forget. 

     

     

    Perhaps some day I'll put together a site or blog post laying out all these options and the pros/cons of each.  There really is quite a few types of Flex development environments in use out there, and I'm always on the lookout for the ideal.

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points