Is JNI able to be multi-processing? and How can I receive Unicode from C-DLL?
JNI can be used in multithreaded applications. When you are calling into a C-DLL, there is always the possibility of the DLL not being able to work in a mult-threaded environment. Mutable global variables used in processing are usually a warning signal.
Specifically addressing your problem though:
- Compare the Unicode character size used in your Oracle library to the definition of
jcharin your platform-specific JNI include file. Make sure they are the same size.
- How does Oracle return Unicode? As UTF-8 or as an array of Unicode characters? It needs to be the latter for
- You can always try calling one of the String class' constructors that takes an encoding as an argument. That should work with whatever Oracle returns.
- Check that you're not caching local or object or class references between invocations. That's forbidden in JNI and can result in exceptions.