I\'ve been trying to write a java program that uses the Runtime.getRuntime().exec()
method to use the command-line to run an instance of the program \"tesseract
You are not capturing STDERR, so when errors occur you do not receive them from STDOUT (which you are capturing). Try:
BufferedReader input = new BufferedReader(new InputStreamReader(
pr.getErrorStream()));
another workaround is give complete installation path of file like /usr/local/Cellar/tesseract/3.02.02/bin/tesseract"
Another workaround without having to recompile and deploy is using the old DOS style paths for e.g C:\Program Files
would be C:\Progra~1
. Of course this will be helpful only if you are reading the paths from a config file or DB and registry etc.
well tesseract
is external command so you do not need to use it with cmd
. Add tesseract
to environment variables. Use direct command as :
String[] commands = {"tesseract", imageFilePath, outputFilePath };
Exist status 1 means Incorrect function. See process exit status