ITesseract instance = new Tesseract();
try {
BufferedImage img = null;
img = ImageIO.read(new File("C:\\Users\\nicol\\eclipse-workspace2\\Read\\images\\text.jpeg"));
instance.setDatapath("C:\\Users\\nicol\\eclipse-workspace2\\Read\\tessdata");
String result = instance.doOCR(img);
System.out.println(result);}
catch(TesseractException e){
e.printStackTrace();
}
}
}
And here i have the output :
00:27:23.450 [main] ERROR net.sourceforge.tess4j.Tesseract - Input not set! java.lang.IllegalStateException: Input not set! at jai.imageio.core@1.4.0/com.github.jaiimageio.impl.plugins.tiff.TIFFImageReader.getNumImages(TIFFImageReader.java:259) at tess4j@3.4.8/net.sourceforge.tess4j.util.ImageIOHelper.getIIOImageList(Unknown Source) at tess4j@3.4.8/net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at tess4j@3.4.8/net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at read.test.main(test.java:18)
I've made sure the file path is correct like i could have seen in some other posts (1st time stackoverflowing, sorry of the editioning that might not be correct)