日期:2014-05-19 浏览次数:20800 次
package org.scavino.twain;
import ins.filemanager.fileuploader.FileUploaderConst;
import ins.filemanager.fileuploader.FileUploaderFrame;
import ins.filemanager.fileuploader.FileUploaderParams;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.StringTokenizer;
import javax.swing.JOptionPane;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class JTwain {
private static final Log logger = LogFactory
.getLog(JTwain.class);
private static final JTwain mInstance = new JTwain();
protected final String DLL_NAME = "jtwain";
private JTwain() {
initLib();
}
public static JTwain getInstance(){
return mInstance;
}
public native boolean isTwainAvailble();
public native String[] getAvailableSources();
public native String[] acquire();
public native String[] acquire(String sourceName);
/*
* Loads the C/JNI Libray
*/
private void initLib(){
try {
String libraryPath = System.getProperty("java.library.path");
if ((libraryPath == null)
------解决方案--------------------
(libraryPath.trim().length() == 0)) {
logger.info("");
return;
}
String systemDir = null;
String firstEntry = null;
String original;
String entry;
StringTokenizer st = new StringTokenizer(libraryPath, ";");
int i = 0;
while (i < st.countTokens()) {
original = st.n