Introduction to Computation and Problem Solving

Similar documents
1.00 Lecture 2. What s an IDE?

MEDIA COMPUTATION DRJAVA. Lecture 11.3 November 7, 2008

SDKs - Eclipse. SENG 403, Tutorial 2

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

Eclipse Setup. Opening Eclipse. Setting Up Eclipse for CS15

Using Eclipse for Java. Using Eclipse for Java 1 / 1

3 Getting Started with Objects

CS 201 Software Development Methods Spring Tutorial #1. Eclipse

Getting Started (1.8.7) 9/2/2009

CS520 Setting Up the Programming Environment for Windows Suresh Kalathur. For Windows users, download the Java8 SDK as shown below.

ECE QNX Real-time Lab

Prerequisites for Eclipse

Lab #1: A Quick Introduction to the Eclipse IDE

Class 9: Static Methods and Data Members

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Using Eclipse and Karel

Creating a new CDC policy using the Database Administration Console

Module 4: Working with MPI

1.00/1.001 Tutorial 1

Lab Android Development Environment

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

Laboratory 1: Eclipse and Karel the Robot

Getting Started with Eclipse/Java

Eclipse Environment Setup

Engr 123 Spring 2018 Notes on Visual Studio

At the shell prompt, enter idlde

QNX Software Development Platform 6.6. Quickstart Guide

You will need to download the Java software development kit from

QClaims Launch Instructions for Windows

CSCI 201 Lab 1 Environment Setup

The purpose of this tutorial is to introduce you to the Construct 2 program. First, you will be told where the software is located on the computer

Getting Started with Eclipse for Java

COMP 110/401 APPENDIX: INSTALLING AND USING ECLIPSE. Instructor: Prasun Dewan (FB 150,

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

Module 3: Working with C/C++

Transitioning Teacher Websites

Module Road Map. 7. Version Control with Subversion Introduction Terminology

DOMAIN TECHNOLOGIES. Getting Started Guide Version 1.1. BoxView IDE. Integrated Development Environment

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

How to use Excel Spreadsheets for Graphing

RTMS - Software Setup

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Barchard Introduction to SPSS Marks

Migration from HEW to e 2 studio Development Tools > IDEs

Just Enough Eclipse What is Eclipse(TM)? Why is it important? What is this tutorial about?

Introduction to IntelliJ

GETTING STARTED WITH ECLIPSE Caitrin Armstrong

Visual Studio.NET. Although it is possible to program.net using only the command OVERVIEW OF VISUAL STUDIO.NET

1 Introduction to MARS

Laboratory Assignment #3 Eclipse CDT

Lab 11-1 Lab User Profiles and Tracking

Assignment 1. Application Development

AP Computer Science A Summer Assignment

Java Program Structure and Eclipse. Overview. Eclipse Projects and Project Structure. COMP 210: Object-Oriented Programming Lecture Notes 1

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

Software Setup and Introductory Assembly programs for the MSP430 *

S8352: Java From the Very Beginning Part I - Exercises

Laboratory Assignment #4 Debugging in Eclipse CDT 1

JCreator. Starting JCreator

SECTION 1: CODE REASONING + VERSION CONTROL + ECLIPSE

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

POOSL IDE Installation Manual

3 TUTORIAL. In This Chapter. Figure 1-0. Table 1-0. Listing 1-0.

Jerry Cain Handout #5 CS 106AJ September 30, Using JSKarel

Using the Zoo Workstations

Javac and Eclipse tutorial

Using Eclipse Europa - A Tutorial

Introduction to Computation and Problem Solving

Using Karel with Eclipse

Lecture (01) Getting started. Dr. Ahmed ElShafee

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

Introduction to Eclipse Rich Client Platform Support in IBM Rational HATS. For IBM System i (5250)

Figure 1. Simplicity Studio

INF 111 / CSE 121. Homework 3: Code Reading

Introduction to Eclipse Rich Client Platform Support in IBM Rational HATS For IBM System i (5250)

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

The QuickCalc BASIC User Interface

DS-5 ARM. Using Eclipse. Version Copyright ARM. All rights reserved. ARM DUI 0480L (ID100912)

Guided Tour (Version 3.3) By Steven Castellucci as Modified by Brandon Haworth

EiffelStudio the Eiffel IDE

2 TUTORIAL. Overview. VisualDSP Getting Started Guide 2-1 for SHARC DSPs

Slide 1 CS 170 Java Programming 1 Duration: 00:00:49 Advance mode: Auto

Barchard Introduction to SPSS Marks

Tutorial: Getting Started - Flow Graph scripting

Printing Tips Revised: 1/5/18

7 The Integrated Debugger

Pre-Lab Excel Problem

Accuterm 7 Usage Guide

Lesson 3 Transcript: Part 1 of 2 - Tools & Scripting

Introduction to the M16C Development Environment

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

Debugging in AVR32 Studio

Application Note: AN00193 Getting Started with Debugging in xtimecomposer

Tutorials. Tutorials* for the jgrasp TM 1.7 Integrated Development Environment

STUDENT WORKBOOK. Teach Yourself: Computer Basics Expert. In 24 Hours or less

Using Eclipse for C Programming

CSC116: Introduction to Computing - Java

MEAP Edition Manning Early Access Program Get Programming with Java Version 1

Transcription:

Class 3: The Eclipse IDE Introduction to Computation and Problem Solving Prof. Steven R. Lerman and Dr. V. Judson Harward What is an IDE? An integrated development environment (IDE) is an environment in which the user performs the core development tasks: Naming and creating files to store a program Writing code (in Java or another language) Compiling code (checks correctness, generates an executable binary) Debugging and testing the code And many other tasks: version control, projects, code generation, etc. Eclipse is one of the standard Java IDEs and the one that we will use in 1.00 for labs, tutorials and homework 2 1

Why Use an IDE? The alternative to an IDE is a command line interface: Not visual Tools for each task are generally not tightly integrated 1.00 students in past terms have not used good software development practice with command line interfaces Neither do many industry programmers While you can do the same things with a command line interface as an IDE, in fact people don t People write software better with an IDE The learning curve for an IDE is about the same as for command line tools, so it s what we use in 1.00 3 What Do IDEs Do? What does an IDE provide? Visual representation of program components Ability to browse existing components easily, so you can find ones to reuse Quick access to help and documentation on existing libraries and tools (vs writing your own) Better feedback and error messages when there are errors in your program A debugger, which is not primarily used to debug, but is used to read and verify code Communication between programmers in a team, who share a common view of the program 4 2

Before Starting Eclipse Create a folder for your Java files In Windows Explorer, create folders: Java Lectures Lecture3 Put each homework, tutorial, and lecture projects each in a separate folder Java thinks that files in the same directory are closely related 5 Starting Eclipse Start Eclipse by double clicking the icon on your desktop. Identify all the interface areas labeled on the next slide. The Main Window is the command center, holding menus, tabs, and buttons. The Explorer allows you to manage files and sets of files (projects) that form programs. The Working Area holds editor, compiler, output or debugger windows as appropriate. If your display looks different, click the option to choose the Java Perspective 6 3

Anatomy of Eclipse Main Window Explorer Working Area 7 Creating a Project Choose File->New->Project Make sure Java Project is highlighted, then click Next 8 4

A New Java Project page appears: Project name: Lecture3 Check Create Project from existing source Browse and select C:\Java\Lectures\Lecture3 using New Folder button as necessary Hit Finish Creating a Project (2) 9 Creating a Project (3) File->New->Class (or click New icon) Type class name: NauticalMile Make sure public static void main( ) is checked Hit Finish 10 5

The NauticalMile Program A nautical mile is defined as the average length of a 1 minute arc of latitude on the earth's surface. So if I told you that the polar circumference of the earth was 24859.82 miles, you could calculate the length of a nautical mile in feet, right? 11 NauticalMile.java public class NauticalMile { public static void main( String [] args ) { double circum = 24859.82*5280; int minutesincircle = 360*60; // a comment double nautmile = circum / minutesincircle; System.out.println( "Feet in a nautical mile = " + nautmile); } } 12 6

Creating NauticalMile.java in Eclipse Write NauticalMile.java in Eclipse Delete the Eclipse-generated comments at top Save it (ctrl-s or File->Save); Eclipse will compile when you save If you get any errors, fix them! After it compiles, make some errors, experiment 13 Compile Time Errors Remove the semicolon from the end of the line that starts double circum Look in the Problems window at the bottom. You should see: Syntax error, insert ";" to complete BlockStatements NauticalMile.java Lecture3 line 6 with a wavy underline where the error was detected and an X at the margin. Click on error message and the corresponding line will be highlighted in the source file. Fix the error. 14 7

Running NauticalMile in Eclipse Once you re able to save with no errors, select Run->Run As-> Java Application Save changes if prompted (OK) Working area changes from editor to output view with console output at bottom of page. 15 Neat Things About Eclipse Key words are highlighted. Java built-in classes have tool tips that show when you place your mouse over them. Type into the window to mess up the alignment of the text lines. Then right click in the editor window and select Source->Format. It will realign your margins. Get full documentation of Java methods: Place cursor on any method or class Hit Navigate-> Open External Javadoc If you don t have this enabled, we ll do it at the end of class 16 8

Checking Your Program Select Debug from the Perspective menu in the upper right corner The Debug Perspective appears, as shown on the next page (you had been in the Java Perspective when writing the program) You ll use this a lot to read and correct (debug) your programs 17 Eclipse Debug Perspective Main Window Status Variables Program code Call stack Console output 18 9

Reading NauticalMile Set a breakpoint to stop your program at or near its beginning Right click on the left margin of the text editor at the desired line ( double circum= ) Select Toggle Breakpoint Or simply double click on the left margin Select Run->Debug As->Java Application Eclipse displays the Debug Perspective Your program stops at the breakpoint line 19 Stepping Through Now step through NauticalMile line by line Use the Step Over icon or hit F6 (Later we ll use Step Into and Step Return ) Variable values display in the Variables Window 20 10

Stepping Through, 2 The Step buttons are a functional family unit: Step Into means stop at every line of code including following method calls. Step Over means stop at every line of code in the current method but execute method calls in one step. Step Return means hurdle over everything in the current method and stop when the method returns. Click Step Over 21 Examining Variable Values In the top right frame of the Debugging View, you'll see the variables Click Step Over once more to advance another line. You should see that you just defined another variable, minutesincircle. Set another breakpoint at the last line (System.out ) Click the Resume button Terminate The program stops at the last line. Click Continue The program output appears, and the program exits. 22 11

Breakpoints What if you are trying to figure out what is wrong with a homework program that s about 100 lines long? Set a breakpoint at the beginning. Run->Debug As->Java Application Step Over line by line looking at variable values until you find an error Terminate and go back to Java Perspective, fix the error, save the file Set a breakpoint at the line you fixed Run->Debug Last Launched The program will run to the line you fixed Resume using Step Over from there You can right click and select Remove Breakpoint to get rid of unneeded ones 23 Exiting the Debugger Sometimes you want to exit the debugger without allowing your program to run to completion. Just click the Terminate button (square) near the Resume button Occasionally you need to clean up the Status Window in the upper left frame Right click in the Status Window Select Remove All Terminated If something is still there, right click on it Select Terminate and Remove 24 12

Managing Files in a Project Deleting files: Go back to the Java Perspective, and right click NauticalMile. Selecting Delete will erase the file. (But hold onto it for now.) Adding files: Same as the first one: File->New Class and so on. Later in the term you ll add other kinds of files to a project. 25 26 Definition of the Meter The French originally defined the meter to be 1/40,000,000 of polar circumference of the earth. A kilometer is 1/40,000 of polar circumference Using that fact and whatever you want to cut and paste from NauticalMile, create the code in class Kilometer to calculate how many kilometers there are in a nautical mile and print it to the Output Window. Since you need decimal arithmetic, define variables as double Or cast (convert) int to double as in Lecture 1 notes Compile and debug. Raise your hand if you need help. To execute Kilometer rather than NauticalMile the first time, from the Java view right click Kilometer in the Package Explorer and select Run (or Debug). If you get 1.609, that's the wrong answer. 13

Attaching Javadoc In the Eclipse menu bar, go to 'Window'->'Preferences'->'Java'->'Installed JREs'. There should be only one installed JRE (jre1.5.0_04) Highlight it and click 'Edit...'. Make sure that Use default system libraries is unchecked. Browse for the correct folder ('C:\Program Files\Java\jre1.5.0_04\docs\api') Click OK. Javadoc is now linked to Eclipse. In Eclipse: Place the cursor on any builtin Java method or class, Select 'Navigate'->'Open External Javadoc' (or Shift+F2) You now have full documentation on the Java class or method Ask a TA for help if you have questions 27 14