6.3. Finding and Loading Native Code

Bridging between Java and native code is both a logical and a physical problem. The logical problem is one of disparate naming and typing systems. To solve this problem, JNI defines a complete, unambiguous mapping from Java names and types to C++ names and types.[2] The physical problem is finding and loading the appropriate native binary. The process of finding and loading native code is very similar to the process of loading Java classes. Both processes are well defined, but they tend to produce cryptic errors and be poorly understood by developers. This section covers the logical and physical mapping between Java and native code, and it shows how to troubleshoot the most common problems.

[2] JNI does not ...

Get Component Development for the Java™ Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.