6.092 | January IAP 2010 | Undergraduate

Introduction to Programming in Java

Syllabus

Course Meeting Times

Lectures: 2 sessions / week for 4 weeks, 1 hour / session

Labs: 2 sessions / week for 4 weeks, 1 hour / session

Description

This course is an introduction to software engineering, using the Java™ programming language. It covers concepts useful to 6.005. Students will learn the fundamentals of Java. The focus is on developing high quality, working software that solves real problems.

The course is designed for students with some programming experience, but if you have none and are motivated you will do fine. Students who have taken 6.005 should not take this course. Each class is composed of one hour of lecture and one hour of assisted lab work.

Installing Java and Eclipse

To write Java programs, you need two things: the Java Development Kit (JDK), and a source code editor. Please follow these directions before the first class, so you can get started on the first assignment faster. If you run into difficulty, we can help you during the first class.

The Java Development Kit contains the tools needed to compile and run Java programs. The source code editor lets you write programs, and has features to make this easier. For this course, you can use any tool you like, but we recommend Eclipse, and will demonstrate it during the first lecture.

Editors

To write programs, you need a piece of software called an editor. They come in two flavors: simple source code editors, or complex integrated development environments. For this course, we recommend using the Eclipse Integrated Development Environment (IDE), but it is useful to be aware of the options that are available to you.

Source Code Editors

A source code editor is a program for editing text, like a word processor, but it has features which make it easier to read and write computer programs. An advantage of using a plain source code editor is that they are usually lightweight applications that are easy to learn and use. Additionally, the editors typically support many programming languages, so you can use the same tool for all your work. The disadvantage is that you will need to use the command line to run the compiler, and to organize larger projects.

For Windows, some popular source code editors are SciTE, UltraEdit, Zeus (old free version), or jEdit. Mac users might want to look at TextMate, SubEthaEdit (old free version), TextWrangler, or jEdit. (Note: some of these are trial versions of software that you need to purchase.)

Integrated Development Environments (IDEs)

Most professional Java developers use an integrated development environment (IDE), which combines a source code editor with other tools for software development. They make it easy to find and correct errors, and to accomplish tasks through a graphical interface, instead of the command line. In this class, we recommend using Eclipse. Other popular IDEs for Java include NetBeans and IntelliJ IDEA.

Windows

Install the Sun Java 6 JDK

You want to install the Java Standard Edition (SE) development kit (JDK). You can find this through Sun’s Java download site, but follow these directions for the direct link:

  1. Go to the Java SE JDK download page.
  2. On the left side, under Platform, select Windows.
  3. Click the Download button.
  4. Click the “Skip this step” link at the bottom of the dialog box that pops up.
  5. Wait for your download to finish.
  6. Run the installer and follow the directions. Accept the default settings.

Install Eclipse

You want the Eclipse IDE for Java developers. You can find this on the Eclipse download site, but follow these directions for the direct link:

  1. Download the Eclipse IDE for Java Developers.
  2. Open the zip file that you downloaded. It contains a single folder named eclipse.
  3. Drag and drop the eclipse folder into C:\Program Files, and perhaps rename it Eclipse. You can actually put the folder anywhere, but C:\Program Files is the typical location.
  4. Start Eclipse by double clicking on eclipse.exe.
  5. Optional: To make it easy to find in the future, create a shortcut from eclipse.exe your Desktop, and rename it Eclipse (drag with the right mouse button to create a shortcut).

Mac OS X

Mac OS X comes with the Java development tools. Run Software Update to ensure that you have the latest version installed (Apple Menu → Software Update).

Install Eclipse

  1. Download the Eclipse IDE for Java Developers.
  2. Open the archive file that you downloaded (Safari may have expanded it automatically for you).
  3. Drag and drop the eclipse folder anywhere you want it (your Desktop may be a good place).
  4. Run Eclipse by double clicking the Eclipse application inside the eclipse folder.

Linux

If you are using Linux, you probably don’t need our help to get Java and Eclipse running yourself. If you do need help, ask one of the instructors during the first lecture.

Course Info

As Taught In
January IAP 2010
Learning Resource Types
Lecture Notes
Programming Assignments