Keeping beans and BeanInfo classes in different projects

When you develop classes in the visual editor for Java, you have the option to keep your .java files and BeanInfo classes in different projects. This enables you to easily develop and deploy the classes separately.

For example, MyProject contains the class runtimeclasses.MyJavaBean. A second project, MyBeanInfoProject, contains the package beaninfoclasses.MyJavaBeanBeanInfo.

Because a BeanInfo class needs to know the class it represents, MyBeanInfoProject must include MyProject in its Java build path. Note that the reverse is not true - MyProject should not include MyBeanInfoProject in its Java build path, because this creates a circular reference.

To configure your workbench setup so that BeanInfo classes are stored in a different project from your .java files:

  1. In the Java perspective, right-click the project that contains the BeanInfo classes and select Properties from the pop-up menu. The Properties window opens.

  2. Select Java Build Path. Click the Projects tab and add the project that contains the Java beans (.java files) to the build path. This defines the location of any classes required at run time that are not part of the current project. You have now met the prerequisite explained above. Close this Properties window.

  3. Open the Properties window for the project that contains the .java files and select BeanInfo Path. Click the BeanInfo classes tab.

  4. Click the Add Projects push button. A dialog box that lists all available projects opens. You can use the text field at the top of the dialog box to filter the list. Once you find the project containing the BeanInfo classes select it and click OK.

  5. The project will now be included in the class path of the virtual machine used for introspection, but you also need to specify the packages that contain the BeanInfo classes. To do this, select the project that contains the BeanInfo classes, and click the Modify Paths push button. In the Modify Searchpaths dialog box that opens, select the package containing the BeanInfo class by clicking Choose Packages. The Select Packages dialog box opens, showing a tree view of packages inside the project.

  6. Select the package that contains the BeanInfo classes. If there is more than one package you can select them in turn. You can also use the Up and Down push buttons to control the order in which they will be searched.

The steps to specify the location of a project's BeanInfo classes when they are in another project are now complete.

Notes:

 

Parent topic

Specifying the location of BeanInfo classes

 

Related concepts

BeanInfo classes and introspection

 

Related tasks

Keeping beans and BeanInfo classes in different packages in the same project
Keeping BeanInfo classes in a JAR file
Explicitly defining the location of BeanInfo classes
Keeping beans and BeanInfo classes in the same package