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. Refer to http://www.junit.org/ for more information on JUnit.
-
Select the menu item File > New > Project.... to
open the New Project wizard.
-
On the left pane of the first wizard page, select Java, and on the right pane, select Java Project. Then click Next.
On the next page, type "JUnit" in the Project name
field and click Finish. A Java perspective opens inside the workbench with the new Java
project in the Package Explorer. When the Java perspective is active, new menu options and Java specific buttons are loaded in the workbench toolbar. Depending on which
view or editor is active, other buttons and menu options will be available.
-
In the Package Explorer, make sure that the JUnit project is selected. Select the menu item File > Import....
-
Select Zip file, then click Next.
-
Click the Browse button next to the Zip file field and browse to select
<eclipseInstallPath>/plugins/org.eclipse.jdt.ui.examples.projects/archive/junit/junit37src.jar.
Note: This step assumes that the JDT example plug-ins have been downloaded and installed.
-
In the Import wizard, below the hierarchy list 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 Perform build automatically on resource modification
option is checked on the Workbench preferences page. You will be
prompted to overwrite the .classpath file 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 this file.
-
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