UnsatisfiedLinkError

Hi,

I'm trying to run following simple code on Unix:

import java.awt.*;

class Test {

public static void main(String[] args) {

String imgFile = "logo.gif";

System.setProperty("awt.toolkit", "com.eteks.awt.PJAToolkit");

Image image = Toolkit.getDefaultToolkit().createImage(imgFile);

System.out.println("width=" + image.getWidth(null));

}

}

when I run it as regular user, it works. But when I run it as root, I got exception:

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 java.awt.Toolkit.loadLibraries(Toolkit.java:1037)

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

can anybody help me

Yongfeng

[1220 byte] By [yongfengw] at [2007-9-26 4:07:07]
# 1
That's because your LD_LIBRARY_PATH environment variable contains directories of that toolkit, but the root account's LD_LIBRARY_PATH does not. Add the toolkit's directories to root's LD_LIBRARY_PATH.
yilin at 2007-6-29 13:08:05 > top of Java-index,Java HotSpot Virtual Machine,Specifications...