JNI method from static lib in ios?

Grigory Ptashko grigory.ptashko at gmail.com
Thu Mar 24 09:50:16 UTC 2016


Hello.

I'm able to launch jdk9 on ios both on the simulator and device.
And also I've managed to remote debug java running in the simulator.

I want to use the JNI method from my java class.
I made a static library libJavaToUIPasteboard.a.

I made it a fat library:

Here’s what lipo -info libJavaToUIPasteboard.a outputs:

Architectures in the fat file: libJavaToUIPasteboard.a are: armv7 i386 x86_64 arm64 


Here's what nm libJavaToUIPasteboard.a outputs:

0000000000000000 T _Java_EvalJava_stringToUIPasteboard
                 U _NSLog
0000000000009b20 S _OBJC_CLASS_$_JavaToUIPasteboard
                 U _OBJC_CLASS_$_NSObject
0000000000009af8 S _OBJC_METACLASS_$_JavaToUIPasteboard
                 U _OBJC_METACLASS_$_NSObject
                 U ___CFConstantStringClassReference
                 U __objc_empty_cache
0000000000009ab0 s l_OBJC_CLASS_RO_$_JavaToUIPasteboard
0000000000009a68 s l_OBJC_METACLASS_RO_$_JavaToUIPasteboard

Just copying this file to app wrapper folder and also specifying the
java.library.path gives java.lang.UnsatisfiedLinkError: no JavaToUIPasteboard in java.library.path.
I tried both System.loadLibrary("JavaToUIPasteboard") and System.loadLibrary("libJavaToUIPasteboard").
They both produce UnsatisfiedLinkError.

I'm a bit confused. How can I use this static lib from my class via JNI.

Thank you.

--
Best regards,
Grigory Ptashko

+7 (916) 1489766
grigory.ptashko at gmail.com
facebook.com/GrigoryPtashko



More information about the mobile-dev mailing list