-1

I am doing an OCR project. getInstance() in tess4j is deprecated. I can't use Tesseract.Tesseract() even which gives an error. How can I solve this?

Code with Tesseract.getInstance()

Code with Tesseract.getInstance()

Code with Tesseract.Tesseract()

[![Code with Tesseract.Tesseract()][2]][2]

This is what is displayed when I compiled the program after I inserted Tesseract tess = new Tesseract() ; enter image description here

user3279893
  • 147
  • 3
  • 16

2 Answers2

0

Tesseract() is a constructor, so you need to use new Tesseract() to get one.

Tomas
  • 1,315
  • 10
  • 17
0

Deprecated methods can still be used. The @Deprecated annotation just means that the library developer plans to stop supporting this method (or remove it from the library) in a future release.

More precisely, from the @Deprecated documentation,

A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists.

You may want to check these out:

It is not a good practice, however, to use deprecated methods and classes, as they may lead to future bugs and compilation problems in your system if the methods or classes are removed and you update the library versions.


However, in your case, Tesseract() is a class constructor. You are making the wrong call, as the correct one would be

Tesseract instance = new Tesseract();

Have a look at the Tess4j documentation to learn more about the Tesseract class.

Community
  • 1
  • 1
Bruno Toffolo
  • 1,504
  • 19
  • 24
  • After adding the above mentioned code snippet , I compiled my program. Finally it gave an exception which is " Exception in thread "main" java.lang.UnsatisfiedLinkError: The specified module could not be found. ". I can't figure out the problem. – user3279893 Oct 30 '15 at 19:22
  • Paste the entire stack trace here or in a site like pastebin.com so we can analyze the problem. :) Is the `Tesseract` library correctly configured in your build path? – Bruno Toffolo Oct 30 '15 at 19:33
  • I Uploaded a screenshot about the stack trace as you suggested. Please help me to configure the error – user3279893 Nov 04 '15 at 16:15
  • Where did you upload the screenshot? – Bruno Toffolo Nov 04 '15 at 16:39
  • I edited my first question and added another screen shot in the above – user3279893 Nov 04 '15 at 19:28