views:

336

answers:

1

I need to display a TIFF (type 4) image in Eclipse from a Java stream. TIFFv4 is not supported, so I need an image library. Sun's JAI-ImageIO has native code -- I can't wrap it easily into a plugin. I can't just import jai-imageio.jar (et al) from the lib\ext directory because Eclipse has its own ideas about classpaths.

Any suggestions for image extensions / libraries usable in Eclipse?

Although I've got the same core code compiling and running on the same Eclipse (Galileo) as a standard Java program, when I make it part of an Eclipse BIRT extension (I modified the RotatedLabel ReportItem example), it fails. What happens is that the code compiles (I added the jars to the jre\lib\ext directory) and it fails at runtime with the following error (in the log file):

SEVERE: Error happened while running the report. java.lang.NoClassDefFoundError: javax/media/jai/PlanarImage at org.eclipse.birt.sample.reportitem.rotatedlabel.util.GraphicsUtil.createDocImage(GraphicsUtil.java:64) at > org.eclipse.birt.sample.reportitem.rotatedlabel.RotatedLabelPresentationImpl.onRowSets(RotatedLabelPresentationImpl.java:135) at org.eclipse.birt.report.engine.extension.ReportItemPresentationBase.onRowSets(ReportItemPresentationBase.java:218)

+2  A: 

I'm not sure this will be sufficient, but if all you need is to get the jai-imageio.jar et al into your Eclipse classpath, you can add the required jars to your plugin, and plugin's classpath and they will be available to the plugin at runtime.

These are the steps to include the jars in your plugin.

  • Create a "lib" folder below your plugin.
  • Add the jars to that folder.
  • Modify the classpath of the plugin to include those jars - In the runtime tab of the manifest, click the Add... button in the Classpath section and select all the jars.
  • Export the packages if needed (e.g. if you have more than one plugin that needs access to the packages) - In the runtime tab of the manifest editor, click the Add... button in the Exported Packages section and select any packages other plugins will need.
Rich Seller
Thanks. The only other thing I had to figure out was that I could include the native libraries for JAI-ImageIO (separate DLLs, not JARs) through "Configure build path" by adding them under "plugin dependencies".
sventech