Eclipse and Java Introduction
-
Learn how to set up zyBooks
-
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.
We will be using the zyBooks LTI to interface with Canvas. Students will log in to zyBooks through the assignments tab in Canvas to submit their scores. Please make sure you are using only ONE zyBooks account (don’t create more than one). Instead, if you find the need for multiple accounts, log into your existing account and add the other email address to your existing account.
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.
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.
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.
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.
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 |