Fun With Jni
So you're stuck at your beautifully written C glue code for running java over a bloated telecommunications platform (yet another).
You're obviously using JNI, as it natively calls java on your shiny shared library C code.
You write a simple program to test your lib, and amazingly, after carefully reading JNI's documentation, you get this lovely message:
You must install a Solaris patch to run the native threads version of the Java runtime. The green threads version will work without this patch. Please check the native threads release notes for more information.
If you are embedding the VM in a native application, please make sure that the native application is linked with libthread.so (-lthread).
That's right.
I'm embedding the VM into a native application, but i can't really link it to whateverlib because I dont have the source for this application.
I won't patch Solaris because this is really not the case, i am sure green threads are dead by now.
The solution:
link my shared library to libhpi (-lhpi) first and to libthread (-lthread) afterwards.
Don't forget to include $JAVA_HOME/jre/lib/sparc/native_threads in LD_LIBRARY_PATH.
Further reading:
It's Been A While The (Not So) Big Comeback Fun With Jni Urlize Those Java Properties The Joy Of (Mac)VimLuis Caldeira said(2 years, 11 months ago)
Hey, if I ever encounter something similar I will use that knowledge to over come :D
You said: