Debugging a combined Java/Flex project

In my previous post I described how you can install WTP in Flex Builder and how you can create a combined Java/Flex project and run it.

But what if you want to debug both the Flex and Java code from the project at the same time?

Actually, it is pretty simple. The steps are very similar with the ones described in the previous post for running the application.

First thing let’s add two break points one in Flex code and one in Java code. My project is using LCDS (LiveCycle Data Services) and I have a custom adaptor written in Java to read/write data to and from databases. So I place one breakpoint inside ActionScript in the function that is called when I want to add a new item and the other breakpoint inside the Java adaptor class that actually adds the item to the database.

The next step is to stop the server from Server view if it is running. After this you need to start it but in debug mode (for these actions you have at the top right of the Server view some icons that perform these actions).

After the server started you right click on the Flex application file and choose from “Debug as” entry of the contextual menu “Flex Application”. This will start the default browser with the Flex application running.

If I click the button that adds a new item, Flex Builder will go in Debug view and you will see the Flex debugger. If you resume, Flex Builder will continue the execution and as the Flex code calls the server destination you will go to the Java code and again Flex Builder goes in debug view this time for Java. Here are the two screenshots one for Flex and one for Java:

We saw how to create a new project that has both Java and Flex natures, then how we can run and debug the project. But what if you have an existent Java project and you want to be able to edit Flex files? I will show you the easiest way in the next post.

5 thoughts on “Debugging a combined Java/Flex project

  1. Pingback: Adding a Flex Nature to an existent Java (WTP) project : Mihai CORLAN

  2. Pingback: Dr Flex & Dr LiveCycle » What is the preferred LiveCycle Data Services development environment

  3. I have an project of Flerry on Flas buider beta

    In this I am actually using flerry and making connection between flex and java.

    I wanted to debugg both flex and java together so how to do that

  4. HI

    Am new to flex.
    Plz guide me for the java with flex and remote object service in flex.

    Regards
    Naresh

Leave a Reply

Your email address will not be published. Required fields are marked *