Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 
Training Index

JavaBeansTM Short Course
Packing Central Perk with Marcel

By MageLang Institute

[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.

[ This page was updated: 10-Nov-99 ]

Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.