Normal AWT code has problem with JNI_load(UnsatisfiedLinkError)

I have my application running under Solaris.

It even works with one Solaris machine, but doesn't work with another one. It's definitely some environment setting problem, but I just can figure it out. Anyone can help? Some library path for X11 not set correct. It's complaining about some AWT code as simple as new Dimension(...).

java.lang.UnsatisfiedLinkError: exception occurre

d 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.j

ava:53)

at java.security.AccessController.doPrivileged(Native Method)

at java.awt.Toolkit.loadLibraries(Toolkit.java:1037)

at java.awt.Toolkit.<clinit>(Toolkit.java:1058)

at java.awt.Dimension.<clinit>(Dimension.java:71)

[1083 byte] By [hongmeid] at [2007-9-26 1:42:36]
# 1

<guess>

I think that you have to be running some sort of X client in order to use AWT on Unix. I also think that there's a sort of "X client stub" thingy out there that you can use so you don't have to start an X client just to run your app.

</guess>

Yours,

Tom

tcopeland at 2007-6-29 2:35:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
Here's a more helpful link: http://developer.java.sun.com/developer/techDocs/SearchData/qa/RE__java_runtime_error_-_X_libraries.htmlYours,Tom
tcopeland at 2007-6-29 2:35:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

UnsatisfiedLinkError are due to library path setting and the JVM path setting error. When the JVM or the invoker cannot find the require shared libraries, it crashes and dumps a "UnsatisfiedLinkError" exception. Set the correct environment before invoking your native code and it should work.

Read your environment specific how-to-documents!

Example to solve your problem (example is RedHat linux specific) :

export LD_LIBRARY_PATH=<jre>/linux:$LD_LIBRARY_PATH

You need to set the path to the libjava.so, client.so and other platform specific shared libraries in your distribution.

tayivan at 2007-6-29 2:35:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...