How to extract text from an image file.
There is a Java library that can help you do that.
You can perform OCR or (Optical character recognition - Wikipedia (https://en.wikipedia.org/wiki/Optical_character_recognition#Applications)) by using Tess4j (JNA wrapper for Tesseract (http://tess4j.sourceforge.net/)) It is a Java JNA wrapper for Tesseract OCR API.
The Java doc for the API is found at Tess4J API (http://tess4j.sourceforge.net/docs/docs-3.0/). They also have a tutorial on how to use this library in Eclipse Development with Tess4J (http://tess4j.sourceforge.net/tutorial/)