Run or Debug a WO Application

Last modified by David Holt on 2005/11/19 11:44

You'll now run your WO Application and get a glimpse at one of the coolest features of Eclipse.

1. If you want to run your WO Application, you can right-click/ctrl-click on the project name, "Run As" => "WOApplication". But Run doesn't give you some of the cool features that you really want. What you'd really like to be able to do is make changes to your source code WHILE you're running and see them reflected in the running app, so don't click Run

Picture 15.png


2. Instead, select "Debug As" => "WOApplication" (Note from Mike: the picture has "WOApplication (profiled)" selected – that's a mistake and I don't have to energy to go and retake the photo at the moment ).

Picture 17.png


3. Eclipse will now look through all the known types for classes that are launchable.

Picture 16.png


4. In our case, we want to run our principal class "Application", so you can type Application in the search field, or scroll down to it in the list and click "OK".

Once you go through this process once, though, you will have a Run/Debug Configuration that you can just reuse every time without having to pick the class.

For reference, a slightly faster way of getting to past this step is to select Run As => WOApplication on the Application class itself in Package Explorer rather than selecting it on the project.

Picture 18.png


6. Eclipse will now execute the WOApplication, opening a Console view at the bottom to show you stdout and stderr (stderr is red, stdout is blue). Additionally, Eclipse by default opens an internal browser that contains your Main.WO. So, hey, that's cool – it works, but that embedded browser has got to go

Picture 19.png


7. Select "Window" => "Preferences..."

Picture 21.png


8. Open "General", select "Web Browser", and change "Use internal Web browser" to "Use external Web Browser", click "Apply" and then "OK".

Picture 20.png


9. Go ahead and stop your WO Application. In the console view, there is a red square on the right side. If you click that, it will terminate your app (it will say "<terminated>" on the title bar of the Console view when it's done, and the red stop square will turn gray). If you want to clear the console output, you can the icon of the paper with the X on it.

10. You want to Debug again, but you can now save yourself some time. On the icon bar of Eclipse, in the second set of icons, there is an icon of a Bug with an arrow next to it and a Play button with an arrow next to it. These are your Debug and Run buttons. If you click the down arrow next to the Debug icon, you will see a list of recent run configurations to choose from. If you want to rerun the last configuration, you can just click the debug icon itself. Run works the same way.

If you want to change any of the configuration options like WO parameters, commandline parameters, VM options, etc, you can click the down arrow and then select "Debug ..." or "Run ..." and then you can edit a plethora of options for the configurations.

11. In our case, we want to just Debug again, so click the Debug icon. You will see Eclipse open the Console view again, but this time your default web browser will launch and you will see the output of your Main.wo component.

Picture 22.png


12. Let's check out Hot Code Replacement. Switch back to Eclipse and leave the app running. Go to the Java tab of Main.wo and change the definition of now() to return a specific date and save. The Eclipse incremental compiler will now compile the changed method and replace it on-the-fly into the running application.

Picture 23.png


13. Reload Safari and you'll see the change. There ARE limitations to Hot Code Replacement. It is not able to replace structural changes to your code – added methods, removed methods, added fields, or removed fields. But most any change INSIDE of method works fine. You will find this to be an enormous productivity boost over the usual run, navigate, stop, fix, run, navigate, stop, fix cycle. Now it's run, navigate, fix, reload.

Picture 24.png


14. Let's go ahead and Create a new WO Component.