java UnsatisfiedLinkError awt.image

时间:2010-03-10 03:55:02

标签: java user-interface image awt

我有一个程序,它使用以下方法来获取图像图标的缩放实例:

public ImageIcon createScaledImageIcon(String filename) {
    ImageIcon icon = new ImageIcon(filename);
    Image image = icon.getImage().getScaledInstance(cardWidth, cardHeight, Image.SCALE_SMOOTH);
    icon.setImage(image);
    return icon;
}

我不知道这是否是问题的根源。但是我收到以下错误消息:

线程“Image Fetcher 0”中的异常java.lang.UnsatisfiedLinkError:sun.awt.image.ImageRepresentation.setBytePixels(IIII [BIILsun / awt / image / ByteComponentRaster; I)V at sun.awt.image.ImageRepresentation.setBytePixels (原生方法)

at sun.awt.image.ImageRepresenation.setPixels(Unknown Source)

at sun.awt.image.ImageDecoder.setPixels(Unknown Source)

at sun.awt.image.GIFImageDecoder.sendPixels(Unknown Source)...

如果我可以提供其他可能有用的信息,请告诉我。

4 个答案:

答案 0 :(得分:4)

尝试重新安装最新版本的Java。您的安装可能已完整/损坏(请阅读similar experience)。

答案 1 :(得分:0)

this link处的用户表示此错误可能是收到Java响应而不是重新启动的结果。但是,“重新启动”是否引用整个计算机,或者只是重新启动java是未知的。

答案 2 :(得分:0)

我在Windows机器上安装Squirrel SQL时遇到了同样的问题。事实证明,原因是PATH的环境设置。我已经将JAVA_HOME设置为指向我安装的Java版本,但是路径中的Java版本早于我安装的版本(位于路径的末尾)。

因此,当您键入" java"。

时,我的JAVA_HOME设置不适合实际在命令行运行的Java版本。

如果您看到这一点,您可以尝试确保您的JAVA_HOME环境变量指向您安装的Java,并确保它首先显示在您的路径中。

答案 3 :(得分:-1)

javadoc说,Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.

猜java不知道如何读取你指定的图像..使用.gif格式。