title: Tess4J IllegalStateException: Input not set
body: <p>So I've set up my Eclipse and the necessary libraries to get Tess4J working, however, it's giving me an error when I use the provided example code. The imagefile is right there in the root of the workspace and I even tried moving it around and even editing the method to point directly to the path. All to no avail. I'm a bit stumped, to be honest and was wondering if someone might have an idea where I need to be looking.</p>
  
  <pre><code>import java.io.File;
  import net.sourceforge.tess4j.*;
  
  public class Main {
  
      public static void main(String[] args) {
          File imageFile = new File("eurotext.tif");
          Tesseract instance = Tesseract.getInstance();  // JNA Interface Mapping
          // Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping
  
          try {
              String result = instance.doOCR(imageFile);
              System.out.println(result);
          } catch (TesseractException e) {
              System.err.println(e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>The error I'm getting is the following:</p>
  
  <pre class="lang-none prettyprint-override"><code>Feb 11, 2014 11:05:13 AM net.sourceforge.tess4j.Tesseract doOCR
  SEVERE: Input not set!
  java.lang.IllegalStateException: Input not set!
      at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.getNumImages(TIFFImageReader.java:268)
      at net.sourceforge.vietocr.ImageIOHelper.getIIOImageList(Unknown Source)
      at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
      at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
      at Main.main(Main.java:12)
  
  java.lang.IllegalStateException: Input not set!
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT: Quick update, as I've been trying to figure out a lot of stuff and trying out multiple things. First of all, I've figured out that the input not set is caused by a wrongly placed .dll file. However, now I've run into a new and much more difficult error. Here is the new code (I merely added a println to verify if it is able to read the file before it goes into the try-catch).</p>
  
  <pre><code>import java.io.File;
  import net.sourceforge.tess4j.*;
  
  public class Main {
  
      public static void main(String[] args) {
          File imageFile = new File("C:\\Users\\Marouane Boutaib\\Java projects\\Tess4j\\eurotext.tif");
          Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping
          // Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping
          System.out.println(imageFile.canRead());
          try {
              String result = instance.doOCR(imageFile);
              System.out.println(result);
          } catch (TesseractException e) {
              System.err.println(e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>However, with this I'm getting a new error:</p>
  
  <pre><code>true
  Exception in thread "main" java.lang.UnsatisfiedLinkError: %1 is not a valid Win32 application.
  
      at com.sun.jna.Native.open(Native Method)
      at com.sun.jna.Native.open(Native.java:1759)
      at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
      at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
      at com.sun.jna.Library$Handler.&lt;init&gt;(Library.java:147)
      at com.sun.jna.Native.loadLibrary(Native.java:412)
      at com.sun.jna.Native.loadLibrary(Native.java:391)
      at net.sourceforge.tess4j.TessAPI.&lt;clinit&gt;(Unknown Source)
      at net.sourceforge.tess4j.Tesseract.init(Unknown Source)
      at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
      at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
      at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
      at Main.main(Main.java:12)
  </code></pre>
  
  <p>My colleagues and me think it's a missing reference, however, I've followed the guide to setting it up and I didn't alter at all from the example code given by Tess4J's developers themselves. On top of that, I have not yet found another instance on Google where this has happened and has been solved.</p>