1

I'm developing a plugin for intelliJ.

This requires to use tesseract. When i tied to execute it as an console application, it works fine.

But when i tried executing a plugin i get the following exception,

SEVERE: Need to install JAI Image I/O package.
https://java.net/projects/jai-imageio/
java.lang.RuntimeException: Need to install JAI Image I/O package.
https://java.net/projects/jai-imageio/
    at net.sourceforge.vietocr.ImageIOHelper.getImageByteBuffer(ImageIOHelper.java:254)

in the following statement

 final TIFFImageWriteParam tiffWriteParam = new TIFFImageWriteParam(Locale.US);

        tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_DISABLED);

        // Get tif writer and set output to file
        final Iterator<ImageWriter> writers =  ImageIO.getImageWritersByFormatName(TIFF_FORMAT);

        if (!writers.hasNext()) {
            throw new RuntimeException(JAI_IMAGE_WRITER_MESSAGE);
        }

ImageIO.getImageWritersByFormatName returns null

I'm able execute this as a console application, but when i try to execute as a plugin for intelliJ it fails.

Can anyone please guide how to use jai-image io in IntelliJ plugin.

Regards, Siva N B

siva
  • 1,429
  • 3
  • 26
  • 47

2 Answers2

0

It looks like you have different classpathes for Intellij and your console. The Intellij version is not able to read tiff files as the java-imageio is missing. You could look here to find the jar, or maybe it is easier to look which jars are on your console classpath which are missing for intellij.

Edit: Some more details. The java imageio lib needs a plugin to read tiff and bmp files. The plugin is usually not bundled with the lib. And it is usually a pain to find the correct jar.

Community
  • 1
  • 1
tobltobs
  • 2,782
  • 1
  • 27
  • 33
0

We need to add jai_codec.jar, jai_core.jar and jai_imageio.jar to jre's ext folder.

When creating as a plugin, the classpath is different as of the console.

I followed the following link, https://www.java.net/node/683477

siva
  • 1,429
  • 3
  • 26
  • 47