Java Reference
In-Depth Information
[bnd] Did not find matching referal for *
[bnd] Errors
[bnd] The JAR is empty
ADDING BND INSTRUCTIONS
What went wrong? You forgot to tell bnd what packages to pull into your new bundle!
Using the JAR -to-bundle cheat sheet from section 6.1.6, add the following bundle
headers to jedit-mega.bnd along with a bnd-specific instruction to pull in all classes
and resources from the build class path and keep them private:
Bundle-Name: jEdit
Bundle-SymbolicName: org.gjt.sp.jedit
Bundle-Version: 4.2
Private-Package: *
Take care with wildcards
Remember that bnd supports wildcard package names, so you can use * to represent
the entire project. Although this is useful when creating mega bundles, you should be
careful about using wildcards when separating a class path into multiple, separate
bundles, or when already bundled dependencies appear on the class path. Always
check the content of your bundles to make sure you aren't pulling in additional pack-
ages by mistake!
Getting back to the task at hand, when you rebuild the jEdit project you now see this:
$ ant dist
...
[bnd] # org.gjt.sp.jedit (jedit.jar) 849
Success! Try to run your new JAR file:
$ java -jar jedit.jar
Whoops, something else went wrong:
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(Unknown Source)
at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)
ADDING RESOURCE FILES
It seems your JAR file is missing some resources. Can you see why? Look closely at the
jar task in listing 6.1; notice how classes come from ${build.directory} , but the
resource files come from . (the project root). You could write a bnd-specific Include-
Resource instruction to tell bnd to pull in these resources, but there's an easier solu-
tion that lets you reuse instructions from the jEdit build file. Take the existing
resource file set from the old jar task, and put it inside a copy task to copy matching
resources to the build directory before the bnd task runs:
Search WWH ::




Custom Search