Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

JavaBeans Short Course

 
Training Index

Short Course

[Tutorial Contents]
[Behavior] [Help] [API Docs] [Solution]



Prerequisites

Skeleton Code

Marcel is Ross's monkey on Friends. He's going to help you package up our Central Perk Bean, from the last exercise, into a .jar file for use within the BeanBox, or some other builder tool. You'll also create a supporting BeanInfo class for the Bean.

Perform the following tasks:


  1. Take the final CentralPerk.java, PerkEvent.java, and PerkListener.java files from the From Kiva Han to Central Perk exercise and place them in their own package.

  2. Create the associated BeanInfo class for CentralPerk. In it, set the descriptive name of the Bean to "Billboard".

  3. The next thing you need to do is to create a manifest file for the Bean's .jar file. Normally, the jar command can create the manifest for you. However, in order for the Bean-builder tool to know that one of the .class files is a Bean, you have to manually create a manifest file. For every .class file, you need to include a line of the form:
    Name: Marcel/CentralPerk.class
    

    Make sure you use a UNIX-style separator character ('/') between directory names and filename. The DOS-style separator ('\') is not valid here.

    For the class that is a Bean, include a second line after the Name: line

    Java-Bean: True
    

    Between each entry, include a blank line.

    The actual filename you use for the manifest does not matter.

  4. From the directory above your package directory, create the jar file.

  5. Startup the BeanBox.

  6. Load the jar file with the 'LoadJar' menu choice under the 'File' menu. The Billboard bean should now appear in the Toolbox. Try it out.

The task numbers above are linked to the step-by-step help page. Also available is a complete solution to the problem, and expected behavior, to demonstrate it.



Copyright © 1997 MageLang Institute. All Rights Reserved.