title: exception while calling the scanner document using java
body: <p>hi i am using java and i am using twain jar to implement read the scanned document from scanner. i am using 64 bit java and 64 bit windows 7. and i added twain 64 related dll in system32. and i am getting these exception like</p>
  
  <pre><code>uk.co.mmscomputing.device.twain.TwainFailureException: Failed during call to twain source.
      cc=No Data Source
      rc=1
  Source Manager Open
  Source Manager Open
  uk.co.mmscomputing.device.twain.TwainIOException: uk.co.mmscomputing.device.twain.TwainScanner.setException:
      Failed during call to twain source.
      cc=No Data Source
      rc=1
      at uk.co.mmscomputing.device.twain.TwainScanner.signalException(TwainScanner.java:131)
      at uk.co.mmscomputing.device.twain.jtwain.signalException(jtwain.java:287)
      at uk.co.mmscomputing.device.twain.jtwain.cbexecute(jtwain.java:243)
      at uk.co.mmscomputing.device.twain.jtwain.nstart(Native Method)
      at uk.co.mmscomputing.device.twain.jtwain.access$200(jtwain.java:12)
      at uk.co.mmscomputing.device.twain.jtwain$1.run(jtwain.java:338)
  uk.co.mmscomputing.device.twain.TwainFailureException: Failed during call to twain source.
      cc=No Data Source
      rc=1
      at uk.co.mmscomputing.device.twain.TwainSourceManager.call(TwainSourceManager.java:27)
      at uk.co.mmscomputing.device.twain.TwainIdentity.open(TwainIdentity.java:70)
      at uk.co.mmscomputing.device.twain.TwainSource.open(TwainSource.java:99)
      at uk.co.mmscomputing.device.twain.TwainSourceManager.openSource(TwainSourceManager.java:93)
      at uk.co.mmscomputing.device.twain.jtwain.cbexecute(jtwain.java:234)
      at uk.co.mmscomputing.device.twain.jtwain.nstart(Native Method)
      at uk.co.mmscomputing.device.twain.jtwain.access$200(jtwain.java:12)
      at uk.co.mmscomputing.device.twain.jtwain$1.run(jtwain.java:338)
  </code></pre>
  
  <h1>my java class is</h1>
  
  <pre><code>public class TwainExample implements ScannerListener{
  
        static TwainExample app;  
  
        Scanner scanner;
  
        public TwainExample(String[] argv)throws ScannerIOException{
         scanner=scanner.getDevice();
         String scanners[]=scanner.getDeviceNames();
         for(String scann:scanners){
             System.out.println(scann);
         }
          scanner.addListener(this);    
          scanner.acquire();
        }
  
        public void update(ScannerIOMetadata.Type type, ScannerIOMetadata metadata){
          if(type.equals(ScannerIOMetadata.ACQUIRED)){
            BufferedImage image=metadata.getImage();
            System.out.println("Have an image now!");
            try{
              ImageIO.write(image, "png", new File("mmsc_image.png"));
            }catch(Exception e){
              e.printStackTrace();
            }
          }else if(type.equals(ScannerIOMetadata.NEGOTIATE)){
            ScannerDevice device=(ScannerDevice) metadata.getDevice();
            try{
  //          device.setShowUserInterface(true);
  //          device.setShowProgressBar(true);
  //          device.setResolution(100);
            }catch(Exception e){
              e.printStackTrace();
            }
          }else if(type.equals(ScannerIOMetadata.STATECHANGE)){
            System.err.println(metadata.getStateStr());
            if(metadata.isFinished()){
              System.exit(0);
            }
          }else if(type.equals(ScannerIOMetadata.EXCEPTION)){
            metadata.getException().printStackTrace();
          }
        }
  
        public static void main(String[] argv){
          try{
            app=new TwainExample(argv);
          }catch(Exception e){
            e.printStackTrace();
          }
        }
      }
  </code></pre>