How to install tesseract in MAC?

29 views
Skip to first unread message

Rakesh Kumar

unread,
Sep 20, 2018, 4:04:09 PM9/20/18
to tesseract-ocr
Can any one please give steps to install tesseract in MAC machine?

Kurniawan Kurniawan

unread,
Sep 21, 2018, 12:43:50 AM9/21/18
to tesseract-ocr
Mac should be the easiest to install.

Rakesh Kumar

unread,
Sep 21, 2018, 9:25:17 AM9/21/18
to tesseract-ocr
Great thank you it worked, i have one more stopper which i need you to address.

I am trying to execute below program with error in my MAC.

package com.chillyfacts.com;

import java.io.PrintWriter;

public class my_main {

public static void main(String[] args) {

String input_file="/usr/local/Cellar/tesseract/PCH app.png";

String output_file="/usr/local/Cellar/pchapp";

String tesseract_install_path="/usr/local/Cellar/tesseract/";

String[] command = { "cmd" };


    Process p;

try {

p = Runtime.getRuntime().exec(command);

        new Thread(new SyncPipe(p.getErrorStream(), System.err)).start();

                new Thread(new SyncPipe(p.getInputStream(), System.out)).start();

                PrintWriter stdin = new PrintWriter(p.getOutputStream());

                stdin.println("\""+tesseract_install_path+"\" \""+input_file+"\" \""+output_file+"\" -l eng");

            stdin.close();

                p.waitFor();

                System.out.println();

                System.out.println();

                System.out.println();

                System.out.println();

                System.out.println(Read_File.read_a_file(output_file+".txt"));

    } catch (Exception e) {

e.printStackTrace();

}

}

}


Error:


java.io.IOException: Cannot run program "cmd": error=2, No such file or directory

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)

at java.lang.Runtime.exec(Runtime.java:620)

at java.lang.Runtime.exec(Runtime.java:485)

at com.chillyfacts.com.my_main.main(my_main.java:13)

Caused by: java.io.IOException: error=2, No such file or directory

at java.lang.UNIXProcess.forkAndExec(Native Method)

at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)

at java.lang.ProcessImpl.start(ProcessImpl.java:134)

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

... 3 more

Kurniawan

unread,
Sep 21, 2018, 11:29:59 AM9/21/18
to tesser...@googlegroups.com
as the error said, it seem there is a path that does not exists in your system

i would suggests to check all your path especially in line 13

Caused by: java.io.IOException: error=2, No such file or directory
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/6a127d27-2a25-4c57-8e79-b9dcb4cf91c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages