JNI not working on SoyLatte

Landon Fuller landonf at bikemonkey.org
Thu Apr 17 18:40:16 PDT 2008

On Apr 17, 2008, at 6:29 PM, Trevor Harmon wrote:

> On Apr 16, 2008, at 10:37 AM, Landon Fuller wrote:
>> Do you have a stand-alone test case that works on Apple's JVM, but  
>> doesn't work on SoyLatte?
> Yes. Attached is a simple JNI test case. To run:
> javac HelloWorld.java
> javah -jni HelloWorld
> gcc -dynamiclib -I$JAVA_HOME/include HelloWorld.c -o  
> libHelloWorld.dylib
> java HelloWorld
> This works fine under Mac OS X 10.5.2 with the built-in Java  
> 1.5.0_13. However, if you then point JAVA_HOME to the location of  
> SoyLatte 1.0.2 and make SoyLatte's bin directory the first element  
> in the PATH, it doesn't work. I get "java.lang.UnsatisfiedLinkError:  
> no HelloWorld in java.library.path"


landonf at max:~/Desktop/JNI> java -Djava.library.path=`pwd` HelloWorld
Hello World!

It looks like Apple's java includes '.' in java.library.path by default:
	scala> System.getProperty("java.library.path");
	res0: java.lang.String = .:/Library/Java/Extensions:/System/Library/ 

Whereas SoyLatte:
	scala> System.getProperty("java.library.path");
	res0: java.lang.String = /usr/local/soylatte16-i386-1.0.2/jre/lib/ 

Additionally, SoyLatte doesn't seem to be respecting DYLD_LIBRARY_PATH.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://mail.openjdk.java.net/pipermail/porters-dev/attachments/20080417/0b88a9da/attachment.bin 

More information about the porters-dev mailing list