wood burning stoves 2.0*
The moose likes Java in General and the fly likes Error loading jpeg Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Error loading jpeg" Watch "Error loading jpeg" New topic
Author

Error loading jpeg

Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
Hey
I get the following error when trying to load an image into my program :
Exception in thread "main" java.lang.UnsatisfiedLinkError: exception occurred in JNI_OnLoad
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1382)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1298)
at java.lang.Runtime.loadLibrary0(Runtime.java:749)
at java.lang.System.loadLibrary(System.java:820)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:53)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:41)
at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
at java.awt.Component.<clinit>(Component.java:356)
at javax.swing.ImageIcon.<clinit>(ImageIcon.java:62)
at thumbnail_app.main(thumbnail_app.java:21)
The two different ways I have tried to do this are :
Image image = Toolkit.getDefaultToolkit().getImage(args[0]);
Image image = new ImageIcon(args[0]).getImage();
Both giving the same error. Why is this occuring?
Any help is greatly appreciated
Thanks in advance,
Brendan
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Is the image file in the classpath? If not, did you specify the full location of the file?


"JavaRanch, where the deer and the Certified play" - David O'Meara
Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
yes, the image I'm working on is in the same directory as the class and I've exported CLASSPATH=.
Could it be the actual JNI that's the problem? I'm on a solaris machine with j2se installed. Or could it be memory constraints (I don't think so, i think there's a different error for that).
Thanks
Keno
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
So- what version of java are you using?
from JNI Enhancements in JDK 1.2

In JDK 1.2, each class loader manages its own set of native libraries. The same JNI native library cannot be loaded into more than one class loader. Doing so causes UnsatisfiedLinkError to be thrown. For example, System.loadLibrary throws an UnsatisfiedLinkError when used to load a native library into two class loaders. The benefits of the new approach are:
Name space separation based on class loaders is preserved in native libraries. A native library cannot easily mix classes from different class loaders.
In addition, native libraries can be unloaded when their corresponding class loaders are garbage collected.
To facilitate versioning control and resource management, JNI libraries in 1.2 may optionally export the following two functions:
jint JNI_OnLoad(JavaVM *vm, void *reserved);
The VM calls JNI_OnLoad when the native library is loaded (for example, through System.loadLibrary). JNI_OnLoad must return the JNI version needed by the native library.
In order to use any of the new 1.2 JNI functions, a native library must export a JNI_OnLoad function that returns JNI_VERSION_1_2. If the native library does not export a JNI_OnLoad function, the VM assumes that the library only requires JNI version JNI_VERSION_1_1. If the VM does not recognize the version number returned by JNI_OnLoad, the native library cannot be loaded
Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
It's java version 1.3.0
Please tell me that I don't have to go writing c code for a native library and let your reason be that java imageing is cross platform compatible!
I have very little c programming knowlege and am loath to go learning another aspect of java while I'm only starting off on JNDI. Do you know any work arounds or c code examples?
Thanks
Brendan
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I am by no means sure - but there is a patch out there for Solaris

Need for Patch Solaris-SPARC Patch # Solaris-x86 Patch # Nature of Patch Problems Without Patch Obtain Patch From

Required 106950-13 or later 106951-13 or later Linker patch. UnsatisfiedLinkError associated with Motif 2.1. Free from SunSolve

From SolarisTM Patches
for Java 2 SDK, Standard Edition, v1.3.1

[ September 05, 2002: Message edited by: Cindy Glass ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error loading jpeg
 
Similar Threads
Need help ImageToCode
Profiling
Runtime error: UnsatisfiedLinkError
Hibernate configuration problem
JDK1.4 Could not lock System prefs