CSE 115 - Fall 2006 - Banner
   CSE 115 - Fall 2006 - Introduction to Computer Science for Majors I
CSE 115 - Fall 2006 - Left Navigation CSE 115 - Fall 2006 - Lab 2

Lab 2

Introduction

We have just begun to look at writing our own Java source code files in class. Writing those files can be an overwhelming task for students who are new to the task. You were just introduced to the lab environment in Baldy 21 and you worked briefly with Eclipse to edit a text file. In this lab, you will work a little more with Eclipse and work with the ideas we have been explored in class about the design of object oriented systems.


Objectives

The high-level objectives of this lab are to have you,
  • set up and customize Eclipse for CSE115,
  • familiarize yourself with the Eclipse environment,
  • create and edit some more text files using Eclipse,
  • learn how to use the JAR utility to create JAR files to submit your work
The following are the new concepts covered in this lab:
  • using CVS repositories
  • Eclipse environment vocabulary
  • creating a JAR file

Assignment Specifications

Work with Eclipse, describe properties and capabilities of some object.


Helpful Hints

Read through the entire lab before you start working, so that you know what to expect. Make sure you save your work often, and keep track of what you are expected to submit.

Do not be afraid to refer to earlier labs to recall what things mean or what commands are available for you to use.


Reading

Make sure you have read chapter 1 of the book before coming to lab. Also make sure you have reviewed your lecture notes. It might also be helpful to begin looking at Chapter 1 of the Eclipse book.


Lab set-up tasks

At your lab session your teaching assistant will briefly discuss how to carry out each of the set-up tasks below. She or he will also be available to answer questions you might have. Before you start work on the lab itself, you must carry out each of the following set-up tasks. Your teaching assistant will guide you through this process.

If you are trying to do this lab from home, please consult this link.

Step 1: Log in

The first thing you must do when you are in the lab is log in at the SunRay in front of you. Remember that this logs you into a machine named,

styx.cse.buffalo.edu

To get access to the prompt [recall that you need the prompt to type UNIX commands], you use the Applications menu and select System Tools and then select Terminal. It is probably always a good idea to open a terminal when you log in. Recall that a terminal window looks like this:

Terminal screen shot

In Lab 1, you should have created a directory for your workspace. You need to ensure that you completed this task by executing the ls command on your home directory and ensuring that you have a directory named cse115. Inside that directory should be a directory named workspace. If you do not have these directories, you need to create them now.

 

Step 2: Start Eclipse

Last time, you should have created an alias for Eclipse in your .alias file. If you did, then simply typing eclipse at the prompt will open the program. If you did not create an alias then you must type /util/eclipse/eclipse & at the prompt, and it might be a good idea to add this alias to your .alias file.

It might also be helpful to create a shortcut on your desktop for Eclipse. To do this:

Right click on your desktop and get the following menu. Select Create Launcher:

Then you will get the Create Launcher dialog. Make your Dialog look like the one below and click "OK":

Now you will see an icon on your desktop for Eclipse. You can double-click on it to run Eclipse.

Once you have started Eclipse, you might be prompted for which workspace you'd like to work in. You should select cse115/workspace. This dialog is reprinted here:

If you haven't done so, be sure to check the box "Use as default and don't ask me again", and then click "OK".

Step 3: Import preferences file

Next you need do tell Eclipse a few things about how you want it to behave. This is a one-time process. In other words, once you have successfully carried out these steps you will NOT need to repeat them in lab.

While working on Lab 1, you ran a script from the prompt. This script put a file in your home directory named cse115.epf. We need you to update this file by running the script again. In order to run the script, do the following:

At the prompt, type /projects/CSE115/Setup/115setup and hit Enter. After you do this, the file named cse115.epf should be in your home directory.

To import the file, you will first need to open the Import dialog. Do this by selecting "Import..." from the "File" menu. It is common practice to abbreviate menu selections that you need to make in instructions like these. For example, we can abbreviate

select "Import..." from the "File" menu
by simply writing "File" -> "Import". This time we'll show the screen shot of the menu item being selected, but from now on we'll simply write menu selections using this abbreviated method. Your teaching assistant can help you if you have trouble locating the correct menu selections.

An "Import" dialog window should appear.

Select the + sign (or the > symbol depending on your OS) and expand the "General" Folder. Note that there is now an option for t "Preferences", as below. Select it and then click "Next".

This opens up an "Import Preferences" dialog window. Browse to the file cse115.epf in your home directory and select it.

The rest of the options should be OK as they are (they should be as in the screenshot above - if not, make them the same). Click "Finish".

 

Step 4: Seeing the connections to code repositories

If you do not have a tab in the lower portion of your screen that says "CVS Repositories", you should open that View so that you can see what Repositories you have connections to. To do this, select Window -> Show View -> Other. You should then select to expand the entry for CVS and select CVS Repositories and click OK. You will now see a view tab on the bottom of your screen that shows which repositories you have access to:

Step 5: Check out Lab2 project from LabSkeletons repository

Open the LabSkeletons repository (click on the "+" or triangle to the left of its name to "spin" it open). Open "Head", and then a dialog will pop up prompting you for your password. The password here is the same one you typed to log into the machine in Baldy 21. Type your password in and then click "OK".

Then the files in the Lab Skeletons Repository will be visible. Select Lab2:

Now right-click, and select "Check out".

In the left-most pane you will now see the Lab 2 project in your workspace. You should expand out the project to see what is inside it. You will notice a file named Lab2Answers.txt. You should open this file now and input your name and recitation section. In this file, you will type in your answers for the next section. It is this project that you will submit for credit for this Lab.


Lab Assignment

As a means of collecting some background information, browse to www.wikipedia.com, and find the entry for “myspace”. Read all about it.

Go to www.myspace.com and search for your favorite band, or visit the myspace page of someone that you know. Use the search feature to find an interesting page, just please try to keep it appropriate for a college lab. You can start with www.myspace.com/beatles.

Note that all of the features on a typical myspace page attempt to capture and showcase the entire personality of a person, group, or band, in order to place that information in the context of a social networking system. It does a good job at this, because it has created space on that page for everything that makes someone “interesting”. Not only are a person’s interesting characteristics listed and behaviors described, the page itself has interesting properties and capabilities that lend itself to social networking.

The myspace page is a model for a person or band, and the myspace site is a model for a community. (A community object that contains people and band objects)

Your task for this lab is to identify those things that make a person or band unique and interesting. Include everything that you would want to include on a person’s or band’s page. List them as properties and capabilities in your Lab2Answers.txt file. The first entry contains an example… a person’s list of friends, which displays pictures and allows you to link to their site. Fill in the remainder of the spaces in the file.

Your second task is to take the view of a computer scientist, and identify the capabilities that need to be included in a web page for that person or band to be a member of a social networking community. Should there be blogs and lists, exchanges of various types, places to go for private and public chats? The first entry again contains an example… the on-screen music player that allows a band to showcase their music.

In effect, design the person/band class, that will fit into the larger community class that will contain person/band objects. Identify the capabilities of the person/band class that enables participation in the community.

When you are finished, be sure to save your file.


What you hand in

When you are finished, you need to export your solution from the Eclipse environment so that you can submit it.

You should now disconnect your completed project from the CVS repository from which you checked out the lab skeleton. To do this, right click on the project name, and select "Team" -> "Disconnect". In the "Confirm Disconnect from CVS" window that pops open select "Also delete the CVS meta information from the file system.", then click "Yes":

Now it is time to package up your completed work to get it ready for submission. Right click on the project name, and select "Export...". An "Export" window will open. Under Java, select "JAR file":

Click "Next>". This brings up a new screen. Make your screen look like the one below:

To pick a name for the file you are exporting to, click the "Browse" button next to the field labelled "JAR file:".

Click "Finish".

Now you can submit the resulting jar file, Lab2.jar. This file should be in your home directory. To submit, you use the electronic submission program that corresponds to your recitation. For instance students in section A1 will submit by typing

submit_cse115a1 Lab2.jar

at the Unix prompt.

***NEW this week: You can now submit from the prompt on styx. Unlike for Lab 1, when you had to log onto another system to submit, this week, you can simply go to your terminal window and type in the submit command.

If when you try to submit you get a message stating "submit_cse115XX: Command not found." then you need to add the following line to your .cshrc file:

set path = ($path /util/bin)

And then type the same command at the prompt. The changes to you .cshrc will take effect the next time you log on.


Due dates

You have one week from the meeting of your lab to submit your solution. For example, if your recitation meets on Tuesday, September 12th then you must submit the lab by 11:59 pm on Monday, September 18th. The due dates are summarized in the table below. You are always welcome to submit early. If you submit more than once, the later submission will simply overwrite the previous one.

To check that your lab was submitted, you can always refer back to the Submit Inspector on the Resources page of the website. After you have entered your user name, your submissions will be shown. Clicking on the name of a file that is a zip file will show you the contents of the zip file so you can verify that you indeed zipped up all the correct files.

Date of lab Due date for electronic submission
Tuesday, September 12 Monday, September 18
Wednesday, September 13 Tuesday, September 19
Thursday, September 14 Wednesday, September 20
Friday, September 15 Thursday, September 21

 

CSE 115 - Fall 2006 - Footer

 

 
Last modified: Sat Sep 9 12:39:00 2006