Starting Eclipse
Eclipse is installed on the computing lab PCs, under the Programs menu,
Computing.
Sample project
Import project
- In Eclipse, select File / New / Project
- Select "Next" (Java Project)
- Under "Project name:", type "Addition"
- Under "Contents", select "Create project from existing source", and
browse to the "Addition" subdirectory where you unpacked the ZIP file.
- Select the "Finish" button.
Browse the project
- If Eclipse's Java Browser is not visible, make it visible by selecting
Window / Open Perspective / Java Browsing.
- You should now have a list of projects shown in the top left, and Addition
should be one of the packages (probably the only one).
- Click on the project name "Addition"; it should show the packages in that
project (just the default package).
- Click on the default package; it should show the "Addition" class in that
package.
- Double-click on the "Addition" class, and its source code should show up.
Run the applet
- Press the green "Run" button. A dialog box should pop up to configure
run configurations.
- Select "Java Applet" and press the "New" button.
- Press the "Run" button and cross your fingers!
- If all goes well, an applet window should pop up. You can play around
with the little addition applet.
Creating a new project
- You may wish to create a new project for each lab; use File / New /
Project.
Installing Java on your own computer
You may also install Sun's Java SE Development Kit on your own computer. You
do so at your own risk; no official support will be given for development
environments other than Eclipse on the lab PCs.
-
Go to Sun's Java developer site (not the cheezy consumer java.com site)
- What you want is the JDK (Java Development Kit).
- You don't need the EE kit for fancy "Web2.0" applications. You don't want just the JRE (Java Runtime
Environment) because it doesn't include the javac compiler.
- The NetBeans IDE
is a cool free editor / development environment (equivalent to Eclipse); you
can try it but it's not needed to write and compile Java programs. It is a
huge download.
- If you don't have an IDE (Eclipse, NetBeans, etc.), you can always use a
plain-text editor like Notepad, vim, etc. The compiler is named
javac, and the runtime environment to execute a Java class is named
java.
- The CD included with the Deitel textbook also has the JDK, the NetBeans
IDE, a plain-text editor (jEdit), and other application.