下面的tess4j JAR是我在IntelliJ IDEA中的Scala SBT项目的一部分,也是作为模块依赖项添加的:
然而,当我试图在Scala工作表中运行以下代码时,我得到了一个java.lang.RuntimeException: Need to install JAI Image I/O package. https://java.net/projects/jai-imageio/
异常:
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)
即使jai-imageio-core-1.3.1.jar
被正确地包含在项目中。
发布于 2017-04-14 17:16:37
将以下行添加到您的build.sbt中,而不是尝试单独添加JAR:
// https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j
libraryDependencies += "net.sourceforge.tess4j" % "tess4j" % "3.3.1"
或您正在使用的任何版本,可在https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j找到
https://stackoverflow.com/questions/42586408
复制