CSE 461: Introduction to Computer Communication Networks, Autumn 2012
  CSE Home   About Us   Search   Contact Info 
Home
Overview
Course email
Anonymous feedback
View feedback
Course wiki
Home Virtual Machines
Homework Turnin
Class GoPost Forum
Gradebook
Schedule
Hw/Project List
   

Project 1: Project Source Setup


1. Fetch and Unpack the Source

The source is at /cse/courses/cse461/12au/461projects.jar. Fetch a copy onto your development machine and unjar it (jar xf 461projects.jar). It will produce a 461projects directory.

2. Establish an Eclipse Workspace

Eclipse probably created a default workspace for you (in a directory named workspace), and will open that one when you launch Eclipse. We want to use a different one.

Launch Eclipse. If you're asked what workspace to open, direct it to your 461projects directory. Otherwise, on the File menu, choose Switch Workspace, then Other... Browse to your 461projects directory. Close the Welcome tab, if that's what you see.

At this point you may see an empty Project Explorer pane in the upper left. If so, you need to import the CSE461 Eclipse projects. Select the File menu, then Import..., then expand General, select Existing Projects into Workspace, and hit Next. For the root directory, browse to your 461projects directory, then OK. A list of (many) projects should appear. Hit Select All and then Finish.

Finally, you may get an Android-related error in a dialog box as you do this, or you might notice that the Android-related projects have build errors. This is an indication of an Android SDK path problem. Select the Windows menu, then Preferences. Now click on Android. Set the SDK Location text box to the path to the Android SDK on your system.

3. Launch the Console Apps

There is a one-time setup in Eclipse that makes future runs more convenient. The purpose is to set an command line argument telling the application where to find its configuration file. To do that, right-click on project ConsoleApps, then Debug As, then Debug Configurations. On the left of the dialog that appears, expand Java Application (if necessary) and select ConsoleStart. Choose the Arguments tab on the right, and in the Program Arguments text box type -d ../ConfigFiles. Now click Apply, and then Debug to start the application. You should see some output in the Console window. (If what you see is a list of files and a prompt asking you to pick one, pick one and hit enter.) You're now at a prompt line asking which application you'd like to execute. Type 'exit' to terminate.

Having set the command line argument, subsequent launches of the app are a bit easier: right-click on ConsoleApps, then Debug As, then Java Application. A dialog appears; choose ConsoleStart and then OK.

4. Launch the App in the Android Emulator

Strictly speaking, we're not doing any Android programming in project 1. However, this is the time to verify that you can run Android code, because there's time in the schedule for that now (and not later).

Right-click on project AndroidApps, then Debug As, then Android Application. The first time you do this, no virtual phone exists, so you will be asked to create one. Work through the creation dialogs, making sure to create a phone that runs Android 2.3.3.

Right-click/Debug As again. Now that you have an emulator, it should come up. We've observed, though, that a first attempt in an Eclipse session to launch the emulator sometimes results in a "Can't connect to adb" error. If you see that, just try again, and it will work.

Okay, at this point the Android emulator should launch. Drag the green lock icon to the right, wait a bit, and a screen asking you to pick a configuration file will appear. That means things are working, and we're done with Android for now.

You can simply kill the emulator's window to terminate it. When working on Android code, though, you don't want to kill the emulator each run. You can relaunch the application (following the right-click, Debug As, etc. procedure above) at any time, even if the emulator is running the old version of the application. That's much faster than rebooting the emulator.

5. Launch the App on a Phone

To run on a phone, first make sure it has USB debugging enabled: touch the grid of dots on the home screen to get the apps page, then select the Settings app, then Applications, then Development, then enable USB debugging. Hit the back arrow repeatedly to get back to the home screen, or the home icon to get back directly, or just leave it where it is.

Connect the phone by USB to your machine. The right-click/Debug As procedure used previously to launch the emulator will now launch the app on the phone. (You may see a dialog asking what you want to do, run on an emulator or the phone, but I think the default is to use the phone if its available.)

6. Generate Javadoc

The code is reasonably well set up to produce Javadoc documentation. Right-click on a project in Eclipse, then Export..., then expand the Java entry, and then click on Javadoc.

Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to zahorjan at cs.washington.edu]