Importing Files into Eclipse
In some projects, source code (.java files) will be provided for you. To incorporate these files into your project, you must “import” them into Eclipse. This page provides step-by-step instructions showing you how to incorporate a .java file provided for you in your instructor's public GL directory into your programming project.
Before You Begin
These instructions assume that you have already created a Project and Package in Eclipse for your programming project, and that Eclipse is up and running. If you are working on your PC/laptop, copy the .java file you wish to import to your desktop (or other convient folder) using a secure copy utility such as WinSCP.
- Right click on the package into which the .java file will be imported
- Click on Import from the drop down list. This will open the Import Wizard dialog box.
- In the Import Wizard dialogue box, select General → File System, then click Next.
- Click the Browse button on the next page (next to “From directory”) to locate the directory that contains the .java file(s) to be imported. Click OK. A selection dialogue box will appear with the directory on the left side and a list of files in that directory on the right side.
- Use the checkboxes to choose the .java file(s) you wish to import. Click Finish.
- The imported file(s) will appear in the package explorer window.
If you wish to read more on importing files and other resources into Eclipse, go the Eclipse help page and enter “import” into the search box.