Eclipse and Java Introduction

Objectives of this Lab
  • Configure zyBooks with your eid

  • Install Eclipse and Java on your personal computer (it is already installed on department machines!),

  • 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.

Configure zyBooks

In order for zyBooks to talk to Canvas, your eid must be in zyBooks. This is entered in the "Student ID" field when registering. This must be your eid and not your CSUID. Your eid is the username you typed to log on to the CS linux systems and to log into Canvas. Your CSUID is a 9-digit number that is on the front of your student ID card. Treat your username with the same privacy you would treat your e-mail address. Treat your CSUID with the same privacy as a Social Security Number (SSN).

Installing Eclipse

If you need any assistance installing Eclipse on your personal computer, your TA will be available to help during this lab. Eclipse makes programming easier by compiling and running your Java programs within a very sophisticated software application. A personal computer is not required for this course, all work can be done on department, but it can be convenient at times to work from home. Here are are few hints:

  • Always install the Java programming language before Eclipse.

  • Versions of Java and Eclipse exist for Windows, MacOS, and Linux.

  • Java is free from here.

  • The Java Runtime Environment (JRE) is only what is required to run Java programs.

  • The Java Development Kit (JDK) is needed to write and compile Java programs.

  • We are currenty using Java 8, also know sometimes as version 1.8.

  • Now you are ready to download the Eclipse Integrated Development Environment (IDE).

  • Eclipse is free from here.

  • We are currenty using the Neon release of Eclipse.

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 L1 and class for starting the first week assignment:

  • Create a new Java project using the (File→New →Project) and name it L1.

  • Right click on L1 in the Package Explorer tab and choose (New→Class).

  • Each class in Java has an associated file of the same name.

  • Check the box to have Eclipse add main to your program.

  • Name it "L1" (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:

// L1 Assignment
// Author: Cam T. Ram
// Date:   1/16/2018
// Class:  CS165
// Email:  eid@cs.colostate.edu

public class L1 {
     public static void main(String[ ] args) {
          System.out.println("Java programming is great!");
     }
}
  • 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 preliminary 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 to the Checkin tab and zyBooks with your eid in the Student ID field.

Important
Submit L1.java to Checkin, using the checkin tab