| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| <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"> |
| <title> |
| Creating your first Java project |
| </title> |
| <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script> |
| </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. |
| </p> |
| <H2>Getting the Sample Code (JUnit)</H2> |
| |
| |
| <P>First you need to download the JUnit source code.</P> |
| <OL> |
| <LI>Click <A href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.ui.examples.projects/archive/junit/junit381src.jar?view=co">here</A> to download the Junit source code</LI> |
| <LI>Save the archive (do not extract) to a directory from now on referenced as <em><Downloads></em></LI> |
| </OL> |
| <H2>Creating the project</H2> |
| |
| <OL> |
| |
| <LI>Inside Eclipse select the menu item <STRONG>File > New > |
| Project...</STRONG>. to open the <STRONG>New Project</STRONG> wizard |
| </LI> |
| <LI>Select <STRONG>Java Project</STRONG> then click <STRONG>Next</STRONG> |
| to start the |
| <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.newWizard(newWizardId=org.eclipse.jdt.ui.wizards.JavaProjectWizard)")'> |
| <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Open the new Java project wizard"> |
| <STRONG>New Java Project</STRONG></a> wizard: |
| <P><img src="images/wiz_new_project.png" alt="New Java Project wizard"></P> |
| On this page, type "JUnit" in the <STRONG>Project name</STRONG> |
| field. Then click <STRONG>Finish</STRONG>. |
| </LI> |
| <LI>In the Package Explorer, make sure that the JUnit project is |
| selected. Select the menu item <STRONG>File > Import...</STRONG>.</LI> |
| <LI>Expand <STRONG>General</STRONG>, select <STRONG>Archive file</STRONG>, and click <STRONG>Next</STRONG>. |
| </LI> |
| <LI>Click the <STRONG>Browse</STRONG> button next to the <STRONG>Archive |
| file</STRONG> field and browse to select |
| <p><em><Downloads>/junit381src.jar</em></p> |
| <STRONG>Note:</STRONG> This step assumes that you followed steps 1-3 in the <STRONG>Getting |
| the Sample Code</STRONG> section above.<BR> |
| </LI> |
| <LI>In the Import wizard, expand the root node, press <STRONG>Deselect All</STRONG> and select only the <STRONG>junit</STRONG> node. |
| 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 junit directory at this time. You will need all |
| of these resources in the tutorial.</EM> |
| <P><img src="images/wiz_import_arch.png" alt="Import archive wizard"> |
| </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>Build |
| automatically</STRONG> option is checked on the Workbench preferences |
| page.</LI> |
| <LI>In the Package Explorer view, expand the JUnit project to view the |
| JUnit packages. |
| <P><img src="images/view_package_explorer_junit.png" alt="Package explorer"></P> |
| </LI> |
| </OL> |
| <P class="nav_footer" id="nav_footer">Next Section: <A href="qs-4.htm">Browsing Java elements using the package explorer</A> |
| </P> |
| <p> |
| <img border="0" src="../images/ngrelc.png" alt="Related concepts" > |
| </p> |
| <p> |
| <a href="../concepts/concepts-3.htm">Java projects</a><br> |
| <a href="../concepts/cjavaviews.htm">Java views</a><br> |
| </p> |
| <p> |
| <img src="../images/ngrelr.png" 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> |
| |
| </body> |
| </html> |
| |