University of Cincinnati logo and link  
Packaging Beans in a Jar File
 
  UC ingot Jars, or Java ARchives, are fairly common entities.  They are composed of compiled Java classes (*.class), and any other files the classes may need to use, such as images and configuration files.
  • For a bean, we need to include the bean classes themselves, as well as any supporting classes.
  • We also need to include a manifest file to describe the bean.  This text file should look something like this:

  • Manifest-Version: 1.0

    Name: DatabaseBean.class
    Java-Bean: True
     

    • This is the necessary information that our IDE needs to be able to use the bean.
    • Use slashes in the Name field to indicate package names.
    • Only mention the beans that you would like to have implemented in the builder tool.
  • To build the JAR:
    • Put all of the needed classes and the manifest into one directory.
    • Call jar cfm jarFileName manifestFileName *.class
  • Now, you can add this JAR file to your IDE.
 Using the Bean in your IDE