jtwain.dll : The jtwain c++ library for windows (64-bit version).

Windows jtwain.dll:

  1. you need (i.e. Windows XP 64, Windows Vista 64):
    - c:\windows\System32\TWAINDSM.dll (download 64 bit data source manager from www.twain.org)
    - c:\windows\SysWOW64\TWAINDSM.dll (download 32 bit data source manager from www.twain.org)
    - c:\windows\twain_64 (XP: does exist, Vista: needs to be created. DSM will not load if folder does not exist.)
    - java sdk i.e. Sun's 1.6.0 u12 which you will find by default in c:\Program Files\Java\jdk1.6.0_12.
    This is the first java version with a 64 bit web browser plugin.
    - c:\Program Files\Java\jdk1.6.0_12\include\jni.h (you need to put these in the compilers search path)
    - c:\Program Files\Java\jdk1.6.0_12\include\win32\jni_md.h
    - twain.h ((download twain 2.0 headers from www.twain.org)
    - uk_co_mmscomputing_device_twain_jtwain.h
  2. open console and cd to jtwain.cpp directory
  3. compile *.cpp and therefore generate the library jtwain.dll like this:

    Windows XP 64:
    Download and Install: Microsoft Platform SDK for Windows Server 2003 SP1
    open console with XP X64-bit IE 6.0 DEBUG BUILD Environment
    start|all Programs|Microsoft Platform SDK ...|Open Build Environment ... |Windows XP 64 ... |Set Windows XP 64 ... Environment
    cl /LD jtwain.cpp jnu.cpp bmp.cpp user32.lib bufferoverflowU.lib

    Windows Vista 64:
    Download and Install: Microsoft Platform SDK for Windows Server 2008
    SDK 2008: Targeting Windows Server 2008 x64 DEBUG
    cl /LD jtwain.cpp jnu.cpp bmp.cpp user32.lib

    If you know and trust me :) you can download jtwain.dll here.
  4. put jtwain.dll into library path of java program (4 possibilities):
    1. use -Djava.library.path=... option, when you start the program.
    2. copy jtwain.dll to the java virtual machine's library folder c:\Program Files\Java\jdk1.6.0_12\jre\bin (Available for all programs started with this jvm [java virtual machine])
    3. or copy jtwain.dll to the operating system's library folder c:\windows\System32. (Available for all java programs and jvms; Just remember on 64 bit systems: 32 bit libraries go into SysWOW64 and 64 bit libraries into System32)
    4. or use uk.co.mmscomputing.util.JarLib.load(...)