If you pay attention to warnings (and you should!) then you should have noticed that we’re having a number of private references warning. A private reference warning means that an exported package uses a type from a private package in its public API. The implication is that that API is not possible to use since the needed types are private.
Unfortunately, many libraries are badly designed and the types referred are actually just part of a private API. It is one of the reasons why it is sometimes worth to not use external JARs.
However, in this case we need to export more packages than
org.dom4j.*. The warnings in the
Problems view in Eclipse provide you with the following information:
Export org.dom4j.datatype, has 1, private references [org.relaxng.datatype]
This means that the
org.dom4j.datatype uses types from
org.relaxng.datatype in its public API. We will therefore have to export
org.relaxng.datatype as well. Looking at the warnings we have the following private references
You could investigate if they are really needed (they could be superpackages) for your purpose but let’s add them to the exports.
Export-Package: \ org.dom4j.*, \ org.relaxng.datatype, \ org.gjt.xpp
In this case we were lucky, adding them to the export list gets rid of the private reference warnings.