Packaging, Testing, and Submitting the Assignment Application for the Java 2 Developer Exam
- File Structure of Your Project Submission
- JAR File
- Building with Ant
- Testing
- Submitting the Assignment
- Need to Know More?
Terms you'll need to understand:
JAR
Ant
Cygwin
Javac
Application file structure
Techniques you'll need to master:
Packaging the entire project in a single JAR file
Running your application from Windows, Solaris, and both at the same time
Uploading your project at Sun's CertManager site
Structuring your solution in a way that is convenient for the evaluator
...
This chapter discusses how you should package and carefully test your certification project. When ready, you must submit full source and object code, including new classes, modified versions of supplied classes, and copies of supplied classes that were not modified. They should be in an appropriate directory structure along with the class files. Several other items must be included in the package, such as HTML/javadoc documentation for all classes, user documentation for the database server and GUI client, a README.TXT file, and a design choices document explaining your major design choices. In the README.TXT file, you must supply the names of the files submitted for your project, include a note about their location in the directory structure, and add a brief description of each file's purpose. Finally, you must package all elements of your project into a single JAR file for submission.
Packaging is the least technical aspect of the certification assignment, but one of the easiest areas in which to make mistakes. Some candidates have failed the certification because they put the database binary file in the wrong directory or forgot to include the README.TXT file. To avoid these silly mistakes, follow the directions in this chapter.
File Structure of Your Project Submission
What directories do you need? Where should you place javadoc documentation? Where does the database binary file go? You must answer these questions before submitting your solution. You can approach the file structure of your project in two parts: how to package the classes and how to organize all the files into a single JAR file.
The application for your certification consists of your source code defining the classes that make up your solution. Regardless of how you build these classes, the source files should be separate from the class files. Remember that using too many directories or throwing everything into a single directory indicates weak organization of your file structure. Placement is debatable for only a few classes. For example, you will probably include a class that is the connection factory. Where should you place it? I placed mine in the database directory, but you could argue for the client or server directory. Otherwise, the directory for the majority of classes is obvious.
The following structure is an example you might consider adapting for your project submission:
Install_Directory <certification_files> README.TXT file and design choices document + mypackage Object class files +- client All the client class files +- server All the server (RMI) class files +- database All the database-related classes + source All the Java source files + mypackage +- client All the client source files +- server All the RMI source files +- database All the database source files + doc javadoc directory
Notice that the mypackage directory will likely be the directory Sun uses in the source structure you downloaded. I recommend using the same one Sun does.
The straightforward approach to organizing your application files is to place the GUI in the client directory, the database binary and associated files in the database directory, and the RMI or socket-specific files in the server directory. Therefore, *.class files go under mypackage, *.java files under source, and *.html files under doc.
Some candidates overengineer their project and submit a huge number of files. At the other extreme, some candidates cram too much functionality in too few classes. Both approaches will receive poor scores. Remember that whatever directory you place a class in, you must use the proper corresponding package declaration, such as this example:
package mypackage.client;