Eclipse.

Slides:



Advertisements
Similar presentations
Basic Java Constructs and Data Types – Nuts and Bolts
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Java Development Tools project.
Introduction to Java Lab CS110A – Lab Section 004 Instructor: Duo Wei.
Eclipse Introduction Dwight Deugo Nesa Matic
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
Eclipse Begin at the Beginning. Where to Find it:
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program.
Software Development COMP220/COMP285 Sebastian Coope Eclipse and Java These slides are mainly based on “Java Development with Eclipse” – D.Gallardo et.
Eclipse IDE. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as teaching.
03 Using Eclipse. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
1 v1.6 08/02/2006 Overview of Eclipse Lectures 1.Overview 2.Installing and Running 3.Building and Running Java Classes 4.Refactoring 5.Debugging 6.Testing.
Fundamentals of Java.  Explain the structure of a Java class  List and explain steps to write a Java program  Identify the benefits of NetBeans IDE.
Author: Loh Jianxiong Christopher Editors: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang.
1 Development Environments AUBG, COS dept Lecture Title: Dev Env: Eclipse (Extract from Syllabus) Reference:
Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Copyright © Curt Hill Java Looking at our first console application in Eclipse.
POS 406 Java Technology And Beginning Java Code
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Debugging. 2 © 2003, Espirity Inc. Module Road Map 1.Eclipse Debugging  Debug Perspective  Debug Session  Breakpoint  Debug Views  Breakpoint Types.
Active-HDL Interfaces Debugging C Code Course 10.
Unit 1: Java and Eclipse The Eclipse Development Environment.
9/2/ CS171 -Math & Computer Science Department at Emory University.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
1 Basic Java Constructs and Data Types – Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C.
Eclipse Project. Installing Visit to download a copy for your home computerhttp:// –Get Release version 3.0 (or.
Author: Loh Jianxiong Christopher Contributions: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang, Tong Chun Kit, Tania Chattopadhyay.
Creating a Java Application and Applet
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security.
Author: Loh Jianxiong Christopher Contributions: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang, Tong Chun Kit, Tania Chattopadhyay.
Introducing IBM Rational Software Architect
Debugging with Eclipse
Introduction to Java Import Scanner class to use in our program
The eclipse IDE IDE = “Integrated Development Environment”
Development Environment
Chapter 2: The Visual Studio .NET Development Environment
Development with Eclipse
Obtaining the Required Tools
Goals Give you a feeling of what Eclipse is.
ATS Application Programming: Java Programming
Debugging Dwight Deugo
Eclipse Navigation & Usage.
Testing and Debugging.
CompSci 230 Software Construction
Important terms Black-box testing White-box testing Regression testing
Important terms Black-box testing White-box testing Regression testing
Debugging with Eclipse
Understanding the Visual IDE
How to Run a Java Program
Introduction to Eclipse
How to Run a Java Program
Download and Installation of code::blocks
Constructors, GUI’s(Using Swing) and ActionListner
Using Eclipse.
Debugging Dwight Deugo
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Java Looking at our first console application in Eclipse
Java Code Review with CheckStyle
Debugging with Eclipse
Software Development Tools Lecture 6
How to Run a Java Program
Presentation transcript:

Eclipse

1. Introduction to eclipse Extensible software development framework based on a plug-in architecture. open source, released under a common public license (CPL). Originally developed by IBM, version 1.0 being released in November 2001 Now under the stewardship of an independent consortium including: IBM, SAP, Sybase, Fujitsu, HP, BEA…

Eclipse architecture “UI” “Core” JDT PDE Platform Runtime Eclipse Platform Workspace Workbench SWT JFace Team Help Debug Ant “Core” “UI”

Eclipse Architecture explained Platform runtime Primary job is to discover the available plug-ins. Each plug-in has an XML manifest file which lists the connections the plug-in requires. The workspace Manages the user's resources which are organized into projects. The workspace maintains a history of changes to resources. The workbench Eclipse's Graphical User Interface, menus, toolbars and perspectives. Perspectives provide a GUI for specific areas of functionality such as debugging, plug-in development,... The Standard Widget Toolkit (SWT) are graphics toolkits which map directly to the OS native graphics. JFace is a toolkit built on SWT.

Eclipse Architecture explained Team Support Version control. Eclipse provides a client for Concurrent Version System (CVS) Help An extensible help component Java Development Toolkit (JDT) Toolkit for the writing and debugging of Java programs. Plug-in Development Environment (PDE) Developing plug-ins for extending ECLIPSE.

Workspace Component Tools operate on files in user’s workspace Workspace holds 1 or more top-level projects Java project package class field method Java editor

Workbench Component Workbench is UI personality of Eclipse Platform UI paradigm centered around Editors Views Perspectives Perspectives are arrangements of views and editors Different perspectives suited for different user tasks Users can quickly switch between perspectives Example: java perspective, debug perspective, resource perspective…

Workbench Component Perspective Switcher Editor Views

2. Eclipse Installation Web Site: http://www.eclipse.org

Eclipse Installation

Eclipse Installation No installer, just unzip it and create a shortcut for eclipse.exe Be sure to install Java first before installing eclipse

Eclipse Installation

3. Running Eclipse Click Or type eclipse after the prompt.

Running Eclipse Choose a workspace (a directory used by Eclipse to store your programs) When you first start Eclipse, Eclipse will ask you to specify the workspace to use.  Accept the default workspace provided by Eclipse or specify an existing directory as the workspace.  Example: 자바강의/dev

Running Eclipse Go to the workbench

Running Eclipse Java perspective ( an interface for editing java source code) Debug Perspective (an interface for debugging the program)

Load an Existing Java Program 1. Open Folder and find the Workspace directory you use for Eclipse. 2. Create a folder named PrintSquares (or any other name you prefer) under the workspace directory. 3. Download PrintSquares.java to PrintSquares folder you just created.

In Eclipse create a project named PrintSquares. Click New Java Project button. Type PrintSquares as the project name and then click Finish button.

4. In Workspace window double click PrintSquares, then (default package), and then PrintSqaures.java. The source code of PrintSquares.java is shown in Edit window.

Compile the program If Build Automatically is checked, the program will be automatically compiled whenever you save the program.

1. Modify “PrintSquares.java” source code as follows: 2. The red marks on the left side of Edit window indicate that there are errors in PrintSquares.java. Move the cursor over a red mark to see the error message. int i; Change to //int i; Modify the code Red marks

3. Click Save button on the toolbar to compile the program 3. Click Save button on the toolbar to compile the program. Problems window shows the errors in the source code. Double click an error message and the cursor in Edit window will automatically move to the line in the source code where the error appears. Cursor move to here Problems window Double click the error message

4. Correct PrintSquares.java source code as follows: 5. Click Save button to compile the code again. //int i; Change back to int i; Error has been corrected No errors

Run the program Right click PrintSquare.java in Workspace window and select Run As> Java Application. 2. Console window shows the outputs of the program. Console window Outputs of the program

Debug a Program 1. Add breakpoints: double-click the gray bar on the left of Edit window. A blue dot indicates a breakpoint. To remove a break point, double click the breakpoint. A break point

2. Select Run->Debug as...->Java Application to start the debugger.

3. Click Yes button in Confirm Perspective Switch window to switch Eclipse from Java Perspective to Debug Perspective. Toolbar for debug Edit window

4. Play with the debug commands and watch the change of variable values in Variable window and the outputs in Console window. Resume resume the execution of a paused program. Suspend temporarily pause the execution of a program. Terminate end the current debug session. Step Into execute a single statement or step into a method. Step Over execute a single statement. If the statement contains a call to a method, the entire method is executed without stepping into the method. Step Return execute all the statements in the current method and returns to its caller. Run to Line runs the program, starting from the current execution point, and pauses places the execution point on the line of code containing the curor, or at at a breakpoint.

5. Switch Eclipse from Debug Perspective back to Java Perspective.

4. Some useful features BankAccount Class

Changing Comments Select Window > Preferences, then in dialog box select Java > Code Style > Code Templates > New Java Files > Edit

Generates Getters/Setters Select Source > Generate Getters/Setters

Generates Getters/Setters

Generate Constructor Using Fields

Generate Constructor Using Fields

Generate Constructors from Superclass

Generate Constructors from Superclass

5. Create a New Java Application Example: create a HelloWorld java application 1. Create a new project named HelloWorld. First click New Java Project button. Then in New Java Project window input the project name as HelloWorld and click Finish button.

Create a New Java Application 2. Click New Java Class button to create a Java class. In New Java Class window, input HelloWorld as the name and check the box "public static void main (String[] args)" if you want a main method. 3. Modify HelloWorld.java source code as follows Add System.out.println(“Hello World”); inside Main method 4. Follow the instructions in the previous slides to compile and run the HelloWorld program.

Closer Look at Hello World Program // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public static void main(String args[]) System.out.println(“Hello World”); }

Closer Look at Hello World Program // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public static void main(String args[]) System.out.println(“Hello World”); } /* helloworld.c: Hello World program */ #define <stdio.h> void main(int argc, char *argv[]) { printf(“Hello World\n”); } Java C The .java file name must be the same as the name of class with main method

main method The class has one method – main() public static void main(String args[]) { System.out.println(“Hello World”); } Command line input arguments are passed in the String array args[] e.g java HelloWorld John Jane args[0]: John args[1]: Jane

import import java.lang.*; Java allows grouping of related classes into a package. It allows different companies can develop different packages, may even have same class and method names, but they differ by package name: ibm.mathlib.* microsoft.mathlib.* Helps in managing name clash problems. Think of this package as library. “import” statement somewhat serves similar purpose as C’s #include If you don’t add import statement, then you need utilise fully qualified name. ibm.mathlib.sin() If you do “import ibm.*” then you can use mathlib.sin() instead.

import Java imports java.lang.* by default So, You don't need to import java.lang.* That means, you can invoke services of java’s “lang” package classes/entities, you don’t need to use fully qualified names. We used System.out.println() instead of java.lang. System.out.println()

public static void main(String args[]) public: The keyword “public” is an access specifier that declares the main method as unprotected. static: It says this method belongs to the entire class and NOT a part of any objects of class. The main must always be declared static since the interpreter uses this before any objects are created. void: The type modifier that states that main does not return any value.

System.out.println(“Hello World”); java.lang.* All classes/items in “lang” package of java package. System is really the java.lang.System class. This class has a public static field called out which is an instance of the java.io.PrintStream class. So when we write System.out.println(), we are really invoking the println() method of the “out” field of the java.lang.System class.