Tess4j on Centos7 server

0

I'm doing an application with OCR (Tess4j) to use on server with wildfly on centos7. I was able to use it in windows and ubuntu, but in centos7 I'm getting it. I installed ghostscript and tesseract, but typing the path of the file and loading the server crashes.

import java.io.File;'Texto pré-formatado'
import net.sourceforge.tess4j.*;
package net.sourceforge.tess4j.example;

public class TesseractExample {
    public static void main(String[] args) {
         ImageIO.scanForPlugins(); // for server environment
        File imageFile = new File("eurotext.tif");
        ITesseract instance = new Tesseract(); // JNA Interface Mapping
        //ITesseract instance = new Tesseract1(); // JNA Direct Mapping
        instance.setDatapath("/home/tessdata"); // replace <parentPath> with path to parent directory of tessdata
        instance.setLanguage("eng");

        try {
            String result = instance.doOCR(imageFile);
            System.out.println(result);
        } catch (TesseractException e) {
            System.err.println(e.getMessage());
        }
    }
}
    
asked by anonymous 20.02.2018 / 20:07

0 answers