0
我試圖在Web應用程序中使用Tesseract OCR。當我將它作爲JAVA應用程序運行時,代碼運行良好。但是,只要我將相同的代碼放入我的Web應用程序中,它就不再起作用了。如果把這個函數放在servlet中,tomcat根本不會啓動。如果我通過創建一個對象從一個單獨的類中調用它,在調試時,我發現該對象根本不會被創建。我已經包括了所有需要的罐子。Tesseract OCR不能在Web項目中工作
代碼中的servlet
OCRFullTrial ot = new OCRFullTrial();
ot.imgOCR();
內的其他類
public void imgOCR(){
File imageFile = new File("D:\\OCRTesting\\0.jpg");
try {
ITesseract instance = new Tesseract(); //
System.out.println("1");
} catch (Exception e) {
System.err.println(e.getMessage());
}
非常感謝!我遵循上述步驟,解決了這個問題。 –
真棒..... :) – DarkHorse
我也試圖獲得一個web服務在Apache服務器上託管。 我正在使用apache tika,並在API中說我只需要引用這個tesseract文件夾就像這樣TesseractOCRConfig config = new TesseractOCRConfig(); config.setTesseractPath(tesseractFolder); 如果我使用WEB-INF,應該如何啓動「/WEB-INF/tesseract/JarFileINeedToSpecifyPath.jar」,我應該在文件夾(tesseract jar文件?)中放置什麼以及應該使用什麼路徑? –