• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Error loading jpeg

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the image file in the classpath? If not, did you specify the full location of the file?
 
Brendan Kennedy
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic