EclipseIntroduction - cse141introductiontoprogramming
Download
Report
Transcript EclipseIntroduction - cse141introductiontoprogramming
Introduction to Eclipse
What is Eclipse?
An Integrated Development
Environment
Provides many features to ease Java
programming
Editor
Debugger
Source Control
…
Getting Eclipse
At the CS labs…
It’s already installed
At home…
Download the latest version at:
You may need to install Java SDK1.5 or JRE if
you haven’t from
http://www.eclipse.org/
http://java.sun.com/javase/downloads/index_jdk5.jsp
For help, send email to
[email protected]
Installing and Running Eclipse
Installation is very simple
Just unpack the downloaded package
Running Eclipse
Then click eclipse.exe (under Windows)
Run eclipse (under Linux)
Eclipse will start running if all the prerequisites are
met
Demo: Run Eclipse
Setting up your Workspace
Workspace is where your projects and
programs are stored.
Usually some directory in the file system
The workspace is set when Eclipse starts
In this course, for instance, we may set the
work space to
/home/usrname/course/cs112b1
All code will be saved in this directory
Demo
Creating Java Projects
Demo: Creating a project for
assignment1 in the workspace
Creating Java Packages
A Package in Java is a group of classes which
are often closely or logically related in some
way
Package corresponds to the directory
hierarchy in the file system.
course.cs112b1.assignment1
Organizing source files into different
packages is a good programming style.
Demo: creating a package
Adding Java Classes
Class is the basic compilation unit in
Java.
Demo: Creating the Employee class of
assignment1
Import existing files
Some files are given and you want to import
them to your projects rather than creating
them again
Demo: Importing other files of assignment1
to the project
You can also copy-and-paste files to your
project folder
Refresh the file view if you don’t see them
Running the code
Currently, no implementation is provided in
the given files. You are expected to fill the
implementation details.
We need a class which has a main() method
as the entrance for execution
Demo: Adding the main() method in
TestPayroll.java and run the program
Other issues
Demo:
Removing files from the project
Check (or not) “Build Automatically”
Window->Preferences
Project->Properties
…
Eclipse provides a very good Help system
“Help->Help Contents” for more information
Questions?