| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <title> |
| Creating your first Java project |
| </title> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| </head> |
| <body> |
| <h1> |
| Creating your first Java project |
| </h1> |
| <p> |
| 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 <a href= |
| "http://www.junit.org">http://www.junit.org/</a> for more information on JUnit. |
| </p> |
| <ol> |
| <li> |
| Select the menu item <strong>File > New > Project...</strong>. to |
| open the <strong>New Project</strong> wizard. |
| </li> |
| <li> |
| On the left pane of the first wizard page, select <strong>Java</strong>, and on the right pane, select <strong>Java Project</strong>. Then click <strong>Next</strong>. |
| On the next page, type "JUnit" in the <strong>Project name</strong> |
| field and click <strong>Finish</strong>. 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. |
| <p> |
| <img src="../images/qs-4.gif" width=480 height=248 alt="Java perspective"> |
| </p> |
| </li> |
| <li> |
| In the Package Explorer, make sure that the JUnit project is selected. Select the menu item <strong>File > Import...</strong>. |
| </li> |
| <li> |
| Select <strong>Zip file</strong>, then click <strong>Next</strong>. |
| </li> |
| <li> |
| Click the <strong>Browse</strong> button next to the <strong>Zip file</strong> field and browse to select |
| <eclipseInstallPath>/plugins/org.eclipse.jdt.ui.examples.projects/archive/junit/junit37src.jar.<br> |
| <strong>Note:</strong> This step assumes that the JDT example plug-ins have been downloaded and installed.<br> |
| </li> |
| <li> |
| In the Import wizard, below the hierarchy list click <strong>Select All</strong>. You can expand and select elements within the <em>junit</em> directory |
| on the left pane to view the individual resources that you are importing on the right pane. <em>Note: Do not deselect any of the resources in the</em> junit directory at |
| this time. You will need all of these resources in the tutorial. |
| <p> |
| <img src="../images/qs-5.gif" width=541 height=550 alt="Import hierarchy list"> |
| </p> |
| </li> |
| <li> |
| Make sure that the JUnit project appears in the destination <strong>Folder</strong> field. Then click <strong>Finish</strong>. In the import progress indicator, notice |
| that the imported resources are compiled as they are imported into the workbench. This is because the <strong>Perform build automatically on resource modification</strong> |
| 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. |
| </li> |
| <li> |
| In the Package Explorer view, expand the JUnit project to view the JUnit packages. |
| <p> |
| <img src="../images/qs-6.gif" width=211 height=302 alt="Package explorer"> |
| </p> |
| </li> |
| </ol> |
| <p> |
| <img border="0" src="../images/ngrelc.gif" alt="Related concepts" width="159" height="27"> |
| </p> |
| <p> |
| <a href="../concepts/concepts-3.htm">Java projects</a><br> |
| <a href="../tasks/tasks-6.htm">Java views</a><br> |
| </p> |
| <p> |
| <img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159"> |
| </p> |
| <p> |
| <a href="../tasks/tasks-110.htm">Working with build paths</a><br> |
| <a href="../tasks/tasks-12.htm">Creating a new Java project</a><br> |
| <a href="../tasks/tasks-45.htm">Using the Package Explorer</a><br> |
| </p> |
| <p> |
| <img src="../images/ngrelr.gif" width=159 height=27 alt="Related reference"> |
| </p> |
| <p> |
| <a href="../reference/ref-121.htm">New Java Project Wizard</a><br> |
| <a href="../reference/ref-view-package-explorer.htm">Package Explorer View</a><br> |
| </p> |
| <a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" width=324 height=14 alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0"></a> |
| </body> |
| </html> |
| |