CS 150 - Fall 2017
Lab 1 - Eclipse and Java Introduction
Monday, August 21, 2017
Objectives of this Lab
- Register for your zyBooks account
- Get Eclipse set up and running on your Linux account
- Write a very simple Java program
- Show you how to submit your programs to the Checkin tab
- And learn about preliminary (and final) testing
Logging In to CS Computers
- Login to the machine using your EID (same username that you use for RamWeb or Canvas).
- Your initial password is your student ID number (the nine digit number on your RamCard).
- After logging in, you will change your password as described below.
- Troubleshooting: Raise your hand if you cannot login!
Changing your Password on CS Computers
- Select "Applications" in the upper left corner of the screen, then select "Terminal Emulator".
- You should now have a terminal window open where you can type Linux commands.
- Note: This is similar to using the DOS command prompt on Windows.
- Use the
passwd
command to change your password.
- We recommend changing it to your RamWeb password, if possible.
- When typing passwords into a terminal window, you will not see anything show up as you type, but characters are being recorded, so be careful.
Register your zyBooks account
For those who have not already created a zyBooks account, we will do so first in this lab.
The subscription for this class is $48 and will last until December 29, 2017.
- Please visit www.zybooks.com and click the Create Account button in the top right corner.
- When filling out the required information you must use your CSU rams email address.
- Additionally, please enter your EID in the Student ID field.
Note: Your EID is your modified name CSU assigned to you, not your 9-digit student number.
For example, if an email address is ktsmith@rams.colostate.edu, this student's EID is ktsmith.
- Next enter the following course code COLOSTATECS150WakefieldFall2017 when prompted.
- Once everyone has registered, we will do a few exercises together in lab to get you started on your first zyBooks assignment.
Using Eclipse
For the remainder of the lab, please use the Linux system, if provided. Your TA will help with
any problems you encounter.
- To start Eclipse, open a terminal and type
eclipse.sh
.
- You must do this every time you launch Eclipse.
- Close the window that welcomes you to Eclipse.
- Select the (Window→Open Perspective→Java).
- You can change perspectives as need be to fit your workflow.
- If your perspective gets messed up, you can reset it by going to (Window→Reset Perspective).
- Close the "Welcome" window if it doesn't disappear automatically.
- Create a default comment header wiht your name and other information by going to
(Window→Preferences→Java→Code Style→Code Templates → Code → New Java Files)
and putting a line for project name, your name, the class, the date, and your email.
Starting the Assignment
Your TA will guide you in creating a project called P1 and class for starting the first week assignment.
- Create a new Java project using the (File→New →Project) and name it P1.
- Right click on P1 in the Package Explorer tab and choose (New→Class).
- Each class in Java has an associated file of the same name.
- Have Eclipse add main to your program by checking the box next to
public static void main(String[] args)
.
- Name it "P1" (Eclipse will add ".java" automatically) and type the code shown below:
Your code should look like this, except with your name and email in the comments:
// P1 Assignment
// Author: Russ Wakefield
// Date: 8/21/2017
// Class: CS150
// Email: Russ.Wakefield@colostate.edu
public class P1 {
public static void main(String[ ] args) {
System.out.println("Welcome to CS150!");
}
}
You can now run your program by clicking the green "Play" shaped button on the toolbar.
Note that the output will appear in the Console window at the bottom.
You should see the program print a line of text to the console.
Submit your program
Your TA will now walk through logging in to the course website, submitting your code,
and viewing preliminary test results. You should pass the first preliminary test. Read the
assignment for P1. Now see if you can add another print
statement and pass a second test. For detailed information on Eclipse,
check out the Eclipse website. The website that allows you to submit progams and get them automatically
graded. The TA will show you how to check the results of your preliminary and final testing,
and how to retrieve your code from the Checkin tab.
Grading
Log into Canvas and answer the first question of the quiz. Raise your hand
and show the TA your successful submittal in Checkin.
Submit P1.java to Checkin