tags:

views:

259

answers:

3

I have a program that makes use of the following method to get a scaled instance of an image icon:

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;
}

I don't know if it's the source of the problem or not. But i get the following error messages:

Exception in thread "Image Fetcher 0" java.lang.UnsatisfiedLinkError: sun.awt.image.ImageRepresentation.setBytePixels(IIII[BIILsun/awt/image/ByteComponentRaster;I)V at sun.awt.image.ImageRepresentation.setBytePixels(Native Method)

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

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

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

Let me know if there is any other information I could include that might be of use.

A: 

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

guess java does not know how to read the image u specified.. use a .gif format.

echo
i'm using .gif'sAlso, the program's methods in question worked when run directly in my ide (drJava) but are not working when being run by the terminal
Allen
Java is not able to find the native implementation. (as u can see the exception occurs in `sun.awt.image.ImageRepresentation.setBytePixels(Native Method)`) Probably there are some problems in classpath configuration. try configuring ur classpath. or try installing latest version of java.
echo
Neither the image type not the class-path has anything to do with this problem. Clearly a corrupted JDK/JRE.
EJP
+3  A: 

Try reinstalling the latest version of Java. Your installation may have been incomplete/corrupt (read similar experience).

polygenelubricants
A: 

A user at this link suggests that this error may be the result of receiving a Java response and not rebooting. Whether "rebooting" referes to the entire computer, or just restarting java is unknown, though.

Henrik