Join David Gassner for an in-depth discussion in this video Using the exercise files, part of Advanced Java Programming.
If you are a premium member of the lynda.com online training library or if you're watching this video series on a disk, you have access to the exercise files that accompany the course. I've copied the exercise files to my desktop, but you can place them anywhere on your hard disk. The exercise files consist of starting and completed Java applications that are delivered as Eclipse projects. On Windows, you'll be able to see certain files within the directories that mark these as Eclipse projects. These include a .settings folder and files called .classpath and .project.
If you're working on Mac OS X, you probably won't see those files in finder but they are there. The projects are mostly setup to work with Java7, although if the code in a particular project doesn't require Java7's new features it will also be usable with earlier versions of the compiler and virtual machine. To get started with an exercise, import the starting project into Eclipse. Within Eclipse go to the menu and choose File > Import, then in the Import dialog choose General and Existing Projects into Workspace, click Next, Browse for the root directory and choose the folder that contains the project, or projects, you want to import.
If you want to import more than one project choose the top-level folder that contains all of those projects. For example, I'll import all of the projects for Java7NF, I'll click OK, I'll make sure I have selected the projects I want to import, and I'll click Finish. I should then be able to open the projects, open the source folder, open the packages, and open the source code files. The first project, numeric literals, is setup to work with Java SC6. All of the other projects throughout the course are designed to work with Java7, and you'll see why when you go into the exercises.
In addition to the starting files, I've also provided solution projects for each exercise. You can also import these. Once again, I'll go through the Import process I'll choose Existing Projects and Browse, and this time I'll go down to the Solutions folder, which is right underneath the exercise files parent directory. Within Solutions you'll find one folder for each chapter in the video series, and once again, you could import all of the exercises for the whole chapter by choosing the appropriate directory.
You'll see that the solution projects have a suffix in their name of _solution, this distinguishes their names from the starting project, so that you can import both at the same time if you like. When you're done with the project, I recommend that you delete it from your workspace but don't delete it from the hard disk. To do this close up the project in the Package Explorer, then right-click and choose Delete. In the Delete Resources dialog don't check this check box that says delete project contents on disk, as it says it cannot be undone.
I'll click OK, the projects are cleared from Eclipse, and I'm ready to go onto the next exercise. If you don't use Eclipse, you should still be able to use the exercise files either from the command line or with any other Java development environment that's compatible with Java7. And if you don't have access to the exercise files, you can create your own Java Applications, following the examples on the screen and using certain files such as graphic files from your own Library.
- Installing Java on Windows and Mac OS X
- Installing Eclipse
- Using new features such as simplified generics
- Working with advanced class structures (member, local inner, etc.)
- Using the Reflection API
- Navigating inheritance trees
- Managing unordered and ordered sets
- Peeking and polling with queues
- Testing and error handling
- Managing files and directories
- Working with I/O streams
- Next steps with Java