title: Tesseract OCR not working in Java on Linux
body: <p>I deployed a war file to my server with Java working in the backend. I'm trying to get Tesseract to work in Java on CentOS, and it simply won't work. It works <em>perfectly</em> on my Windows localhost, though. The code I have is:</p>
  
  <pre><code>private void doOCR(File file) // The image file
  {
      InputStream stream = new FileInputStream(file);
  
      ContentHandler handler = new BodyContentHandler();
      Metadata metadata = new Metadata();
      ParseContext context = new ParseContext();
  
      TesseractOCRConfig config = new TesseractOCRConfig();
      config.setTesseractPath(TESSERACT_PATH);
      // Path on Windows is C://Tesseract-ocr and path on Linux is /usr/local/bin
      context.set(TesseractOCRConfig.class, config);
  
      TesseractOCRParser tessParser = new TesseractOCRParser();       
      tessParser.parse(stream, handler, metadata, context);
      stream.close();
      System.out.println(handler.toString()); // handler.toString() prints extracted text
  }
  </code></pre>
  
  <p>This code works on Windows, but not on Linux. I <strong>can</strong> do Tesseract from the command line, however, and the output file contains the correct text. Tesseract just won't work from Java on Linux. Is there anything I am missing here? Thanks!</p>