Quickly debug Flex/Java web application from Eclipse?

后端 未结 3 1422
隐瞒了意图╮
隐瞒了意图╮ 2021-01-07 15:15

I have a Flex/Java web application that uses Maven as a build tool. Currently, if I want to debug the entire application I use Maven to create the WAR file and use the carg

3条回答
  •  甜味超标
    2021-01-07 15:32

    First of all you should download Eclipse for Java EE developers* and install Flash Builder as a plugin, pointing to your existing Eclipse, during installation. Having that you should be able to create Flex project through

    File -> New -> Other -> Flex Builder -> Flex Project
    

    Here you need to set Application server type to J2EE and make sure you have Create combined Java/Flex... option checked. I usually leave Use remote object access service option unchecked as I'm using GraniteDS so it's up to you if you need it or not.

    On the next screen you need to configure your Application Server. Here are the steps for Tomcat:

    • Target runtime -> New -> Apache -> <> (change server name and host name to whatever suits you best or - my favorite :) - leave it as it is)
    • Tomcat installation directory should point to where you've installed your Tomcat - by default it is C:\Program Files\Apache Software Foundation\Tomcat 6.0. If you don't have Tomcat installed you can do so by using Download and install wizard
    • On the next screen you're supposed to add web applications you want to have deployed to the server but, as you probably don't have any right now, just press Finish.
    • Select Tomcat server you've just created (you may want to play with rest of the settings like Context root etc.)
    • Next screen and some more settings I usually left default :)
    • Finish

    Window -> Show view -> Other -> Server -> Servers -> OK will open servers view where you can manage your Tomcat server. Use RMB on your server name, then Add and remove, select your application, click Add and Finish.

    Now, 3 icons above the server name and to the right are used to start the server, starting from the left, in debug, normal and profiling mode. Press debug one and server should start - now you will be able to debug Java code you put on the server.

    Last step is to start Flex app in debug mode. Below menu bar you can see icons similar to those used to start the server. Press the down arrow located near debug one and select Debug configurations. Double-click Flex Application, change the name of your newly created configuration and correct debug URL to match your server configuration (leave it as it is if you left everything default up to now). Press Apply and Debug and here you are debugging :) Use F5 to step into, F6 to step over and F8 to continue.

    PS: You may want to change default browser your application is started in (by default it is in-built Eclipse browser I think). You do that by going to Window -> Preferences -> General -> Web Browser.

    Happy debugging :)

    * unfortunatelly I'm using older version of the IDE so above steps may be slightly different than what you have in your Eclipse but you should get general idea. Also Flex Builder 3 seems to be incompatible with latest Eclipse releases (Flex Projects are not fond of being created in Helios release)

提交回复
热议问题