bugfoot
bugfoot

Reputation: 667

"Need to install JAI Image I/O package." error when using tess4j in IntelliJ IDEA Scala SBT project

The below tess4j JARs are part of my Scala SBT project in IntelliJ IDEA and are also added as module dependencies:

enter image description here

However, I get a java.lang.RuntimeException: Need to install JAI Image I/O package. https://java.net/projects/jai-imageio/ exception when trying to run the following code in a Scala worksheet:

import java.io.File
import net.sourceforge.tess4j._

val imageFile = new File("LinkToJPGFile")
val instance = new Tesseract()
instance.setDatapath("MyTessdataFolder")

val result = instance.doOCR(imageFile)
print(result)

even though jai-imageio-core-1.3.1.jar is properly included in the project.

Upvotes: 0

Views: 2520

Answers (1)

bugfoot
bugfoot

Reputation: 667

Instead of trying to add the JARs individually, add the below line to your build.sbt:

// https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j
libraryDependencies += "net.sourceforge.tess4j" % "tess4j" % "3.3.1"

Or whichever version you are using found at https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j

Upvotes: 1

Related Questions