| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. 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>Go to the <A href="http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</A> |
| page</LI> |
| <LI>Select the link 'Other downloads for...' for the release you are working with</LI> |
| <LI>Scroll down to the <EM>Example Plug-ins</EM> section and download |
| the examples archive.</LI> |
| <LI>Extract the contents of the Zip file to a directory from now on referenced as <Downloads> (e.g. c:\myDownloads). |
| </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/qs-newjavaproject.png" alt="New Java Project wizard"></P> |
| On this page, type "JUnit" in the <STRONG>Project name</STRONG> |
| field. Make sure the <STRONG>JDK compliance</STRONG> is set to 1.4, and click <STRONG>Finish</STRONG>. |
| (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"). |
| </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 |
| <Downloads>eclipse/plugins/org.eclipse.jdt.ui.examples.projects_3.0.0/archive/junit/junit381src.jar.<BR> |
| <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, below the file tree 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.png" 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>Build |
| automatically</STRONG> 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.</LI> |
| <LI>In the Package Explorer view, expand the JUnit project to view the |
| JUnit packages. |
| <P><img src="../images/qs-6.png" alt="Package explorer"></P> |
| </LI> |
| </OL> |
| <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/concepts-6.htm">Java views</a><br> |
| </p> |
| <p> |
| <img src="../images/ngrelt.png" alt="Related tasks" border="0" > |
| </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.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> |
| |