views:

164

answers:

1

Is it possible to build classes for a JavaBean in separate JAR files? Specifically- a JavaBean has the Bean and BeanInfo classes in one JAR file and the Custom Property Editor class inn a different JAR, the JAR file with the Bean and BeanInfo classes has the JAR file with the Custom Property Editor class on the classpath, but during drag and drop of the JavaBean in an IDE, a class not found exception is thrown for the Custom Property Editor class. Are all classes for a given JavaBean required to be built into the same JAR file?

A: 

The PropertyEditorManager looks for the property editor (JavaBean spec):

  1. by looking if an editor has been registered explicitly. Since you are using drag and drop I suppose this is not a good solution for you.
  2. looking for 'package.BlahEditor' where 'package.Blah' is your JavaBean. So the names have to be correct for the IDE to find the editor.
  3. looking for BlahEditor in a searchlist defined by the container. Again, since you are using drag and drop this is not a solution.

I don't think that there is a problem using different jars, or packaging the editor in a separate jar.

I do not have enough information to give a conclusive but I can only suggest to check the naming conventions of your property editor against the name of your JavaBean.

Bruno Ranschaert