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.Tesseract()]]
This is what is displayed when I compiled the program after I inserted Tesseract tess = new Tesseract() ;enter image description here
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