所以我完成了我的应用程序的编码,以旋转需要 JAI 来操作 TIFF 的 TIFF 图像。
在 Eclipse 下工作时它工作正常,但是每当我为库构建一个胖 jar 并创建一个实现该库时(根据http://fjep.sourceforge.net/fjeptutorial.html),当我执行 java -jar Push 时。 jar \path\to\dir,它会一直运行,直到遇到它正在压缩和保存的部分:
TIFFImageWriterSpi tiffspi = new TIFFImageWriterSpi();
ImageWriter writer = tiffspi.createWriterInstance();
//Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName("TIFF");
//ImageWriter writer = iter.next();
ImageWriteParam param2 = writer.getDefaultWriteParam();
param2.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
param2.setCompressionType("LZW");
param2.setCompressionQuality(0.0f);
File fOutputFile = workArea[i];
ImageOutputStream ios = ImageIO.createImageOutputStream(fOutputFile);
writer.setOutput(ios);
if (frontPage == 1)
{
writer.write(null, new IIOImage(pg1, null, null), param2);
writer.writeInsert(-1, new IIOImage(pg2, null, null), param2);
}
else if (frontPage == 2)
{
writer.write(null, new IIOImage(pg2, null, null), param2);
writer.writeInsert(-1, new IIOImage(pg1, null, null), param2);
}
remaining = remaining - 1;
if (remaining > 0)
System.out.println(remaining + " remaining.");
else
System.out.println("Done.");
它在该部分的第一行爆炸并显示以下消息:
Exception in thread "main" java.lang.IllegalArgumentException: vendorName == null!
....rest of stack trace.