我已经知道还有其他关于此的主题,但我找不到我的问题的答案。我已经下载了 morena 的包来使用 Twain 和 WIA api,因为我需要制作一个使用本地扫描仪进行文档扫描的 java 应用程序。我有一个包含我需要的所有类的单个 jar,并且我已将其正确放入我的项目文件夹中(我使用 net beans 进行编程),并且我已经完成了一个允许使用我的 epson 扫描仪并进行扫描的测试应用程序. 当我运行时出现此错误:线程“main”中的异常java.lang.SecurityException:类“SynchronousHelper”的签名者信息与同一包中其他类的签名者信息不匹配。
在其他主题中,一些用户建议打开清单并删除所有签名,但是当我这样做时,net beans 会标记一个错误,因为没有签名。有人有想法吗?对不起,如果有一些语法错误,但我是意大利人。谢谢大家。
import eu.gnome.morena.*;
import java.awt.image.BufferedImage;
import java.util.List;
public class main {
public static void main(String[] args) throws Exception {
Manager manager = Manager.getInstance();
//Vector that contains the references to all my local scanners
List<? extends Device> devices = manager.listDevices();
//the position [0] contains my epson scanner
Device device = (Device) devices.get(0);
if (device instanceof Scanner) {
Scanner scanner = (Scanner) device;
scanner.setMode(Scanner.RGB_8);
scanner.setResolution(75);
scanner.setFrame(100, 100, 500, 500);
} else if (device instanceof Camera) {
}
//SynchronousHelper--> the class that make problems
BufferedImage bimage = SynchronousHelper.scanImage(device);
System.out.println("Informazioni del file scannerizzato: dimensioni=(" + bimage.getWidth() + ", " + bimage.getHeight() + ") bit mode=" + bimage.getColorModel().getPixelSize());
Thread.sleep(30000);
}
}