Keeping beans and BeanInfo classes in different packages in the same project

When you develop classes in the visual editor for Java, you have the option to keep your .java files and BeanInfo classes in different packages within the same project.

To accomplish this, edit the properties of the Java project to configure the BeanInfo search path that the visual editor uses. By keeping them in separate packages, you are separating design-time and run-time classes, so you can deploy them separately.

For example, a project called MyProject contains the following packages:

To configure the setup just described:

  1. In the Java perspective, right-click the project that contains both packages, and select Properties from the pop-up menu.

  2. Select BeanInfo Path from the list of properties.

  3. On the Packages page, make sure the Enable BeanInfo Introspection on this Project check box is selected. Otherwise, no information in the BeanInfo path will be used at any time for the project.

  4. Click the Choose packages button, and select one or more packages in the same project that contain the BeanInfo classes.

  5. Optional: If you want to change the order in which packages are searched during introspection, click the Order and export tab and use the Up and Down buttons. During introspection, the rules for finding a suitable BeanInfo class for a Java bean are applied to each package in turn. Changing the order of packages is required only if there are two or more possible BeanInfo classes that may be candidates for the same Java bean class.

  6. If you want these packages to be included in the BeanInfo search path for classes in other Java projects that reference classes in this project (and therefore include this project in their Java build path), the package that contains the BeanInfo classes must be exported. Confirm the following settings:

    1. On the Order and export tab of the BeanInfo properties, make sure that the packages that contain the BeanInfo classes are selected for export.

    2. On the Java Build Path properties page for the same project, make sure that the packages containing the BeanInfo classes are not excluded from export there. Excluding them on the Java Build Path properties overrides your setting on the BeanInfo Path properties page.

When the introspector is created for the project, it includes all packages specified in the Packages list in its search path.

 

Parent topic

Specifying the location of BeanInfo classes

 

Related concepts

BeanInfo classes and introspection

 

Related tasks

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