I wrote an article with free source code for the C++ and Java.
http://www.javaworld.com/article/2074455/java-app-dev/bridge-the-gap-between-java-and-twain.html
If you are interested in a low cost commercial version with support for webcams then visit jtwain.com