Importing the sample code into an Eclipse project
Most of the sample files are written without a package, so they go directly
in the src
folder (the "default package") in Eclipse.
There are many ways to get the sample files into an Eclipse project;
here are a couple of options:
-
- Right-click on the link and click "Save Link As..."
- Save to some temporary location such as your Downloads folder
- Find the
src
folder for your project in the Eclipse Package Explorer.
- Open up the Windows File Explorer (or Finder on a Mac), and
drag the file from File Explorer into the
src
folder.
- Important: Be sure to select the "Copy files" option in the dialog that comes up.
-
- Choose or create
an Eclipse project where you want to put the code.
- Right-click on the
src
folder in that project and select "New" and then "Class".
- In the New Class Dialog
that comes, up, type the class name and make sure that the "Package:" text box is blank. Click Finish.
- Then, you can just copy and paste the code from your browser into the editor window for the new class.