Creating your first Java project
In this section, you will create a new Java project. You will be using
JUnit as your example project. JUnit is an open source unit testing framework for Java.
Getting the Sample Code (JUnit)
First you need to download the JUnit source code.
- Go to the http://www.eclipse.org/downloads/
page
- Select the Downloads link under Java Development Tools.
- Select the link for the release that you are working with.
- Scroll down to the Example Plug-ins section and download
the examples archive.
- Extract the contents of the Zip file to a directory from now on referenced as <Downloads> (e.g. c:\myDownloads).
Creating the project
- Inside Eclipse select the menu item File > New >
Project.... to open the New Project wizard
- Select Java Project then click Next
to start the New Java Project wizard:

On this page, type "JUnit" in the Project name
field. Make sure the JDK compliance is set to 1.4, and click Finish.
(If you are interested in the new features in Eclipse supporting J2SE 5.0 development,
see the companion guide "Getting Started with Java 5.0 development in Eclipse").
- In the Package Explorer, make sure that the JUnit project is
selected. Select the menu item File > Import....
- Select Archive file, then click Next.
- Click the Browse button next to the Archive
file field and browse to select
<Downloads>eclipse/plugins/org.eclipse.jdt.ui.examples.projects_3.0.0/archive/junit/junit381src.jar.
Note: This step assumes that you followed steps 1-3 in the Getting
the Sample Code section above.
- In the Import wizard, below the file tree click Select
All. You can expand and select elements within the junit
directory on the left pane to view the individual resources that you
are importing on the right pane. Note: Do not deselect any of the
resources in the junit directory at this time. You will need all
of these resources in the tutorial.
- Make sure that the JUnit project appears in the destination Folder
field. Then click Finish. In the import progress
indicator, notice that the imported resources are compiled as they are
imported into the workbench. This is because the Build
automatically option is checked on the Workbench preferences
page. You will be prompted to overwrite the .classpath and .project
files in the JUnit project. This is because the .classpath resource was
created for you when you created the JUnit project. It is safe to
overwrite these files.
- In the Package Explorer view, expand the JUnit project to view the
JUnit packages.

Java projects
Java views
Working with build paths
Creating a new Java project
Using the Package Explorer
New Java Project Wizard
Package Explorer View