Java code working fine when created as an independent static main class, but not when called from servlet
<p>I am using Tess4j API for performing OCR and have created a dynamic web project in eclipse. If I create a new java class directly under the Java resources folder, the code is working fine.<br/></p>

<pre><code>    public static void main(String[] args){
        File image = new File("Scan0008.jpg");  
        ITesseract instance = new Tesseract();
        try{
            String result = instance.doOCR(image);
            System.out.println(result);
        }catch(TesseractException e){
            System.err.println(e.getMessage());
        }
    }
</code></pre>

<p>However I am getting an exception when I am calling the same code from my Servlets doPost method.<br/></p>

<pre><code>    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            Validate valObj = new Validate();
            valObj.validate();
    }
    public void validate() {
        File image = new File("Scan0008.jpg");
        ITesseract instance = new Tesseract();
        try {
            String result = instance.doOCR(image);
            System.out.println(result);
        } catch (TesseractException e) {
            System.err.println(e.getMessage());
        }
    }
</code></pre>

<p>I have included all the required jars under lib folder of WEB-INF. Have also added the jars in the projects build path. Could anyone please let me know what I am doing wrong.<br/>
Exception  : <br/>
java.lang.IllegalStateException: Input not set<br/>
23:33:45.002 [http-bio-8080-exec-5] ERROR net.sourceforge.tess4j.Tesseract - Input not set<br/>
java.lang.IllegalStateException: Input not set</p>