Eclipse extension for opening TIFF (type 4) images?

被刻印的时光 ゝ 提交于 2020-01-02 14:29:18

问题


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)


回答1:


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.


来源:https://stackoverflow.com/questions/1261462/eclipse-extension-for-opening-tiff-type-4-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!