# java-native-access/jna

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/java-native-access-jna).**

8,913 stars · 1,678 forks · Java · NOASSERTION

## Links

- GitHub: https://github.com/java-native-access/jna
- awesome-repositories: https://awesome-repositories.com/repository/java-native-access-jna.md

## Description

JNA is a foreign function interface and native memory mapper that allows Java applications to call functions in shared native libraries without writing custom JNI wrapper code. It serves as a JNI alternative framework for invoking C functions and mapping native data structures using high-level interfaces.

The library distinguishes itself through its ability to translate Java objects and primitives into C-style structs, unions, and pointers for cross-platform memory exchange. On Windows, it provides a dedicated toolkit for interacting with Component Object Model objects using both early and late binding.

The framework covers broad capability areas including native library integration, runtime symbol resolution, and data marshaling for complex memory layouts. It provides tools for native callbacks, shared library loading from system paths, and platform-specific API mappings for operating system tasks. Diagnostic features are included for library loading, system error retrieval, and native crash protection.

The project supports compiling native library components for various device architectures on the Android platform using standard native development kits.

## Tags

### Operating Systems & Systems Programming

- [Native Function Invocations](https://awesome-repositories.com/f/operating-systems-systems-programming/native-function-invocations.md) — JNA allows the invocation of functions within shared native libraries across different operating systems without writing custom JNI wrapper code. ([source](https://github.com/java-native-access/jna/blob/master/CHANGES.md))
- [Direct Memory Access](https://awesome-repositories.com/f/operating-systems-systems-programming/direct-memory-access.md) — Provides the ability to read and write raw memory addresses to handle native pointers and global variables.
- [Dynamic Library Loading](https://awesome-repositories.com/f/operating-systems-systems-programming/dynamic-library-loading.md) — Locates and loads native libraries from system paths, environment variables, or bundled classpath resources. ([source](https://github.com/java-native-access/jna/blob/master/www/GettingStarted.md))
- [Native Memory Mappers](https://awesome-repositories.com/f/operating-systems-systems-programming/native-memory-mappers.md) — Translates Java objects and primitives into C-style structs, unions, and pointers for cross-platform memory exchange.
- [Platform API Access](https://awesome-repositories.com/f/operating-systems-systems-programming/platform-api-access.md) — Utilizes pre-defined mappings for common system functions to simplify cross-platform native access. ([source](https://github.com/java-native-access/jna#readme))
- [Platform Library Mappings](https://awesome-repositories.com/f/operating-systems-systems-programming/platform-library-mappings.md) — Provides built-in mappings of common native functions to simplify access to platform-specific system calls. ([source](https://github.com/java-native-access/jna/blob/master/README.md))
- [System Call Interfacing](https://awesome-repositories.com/f/operating-systems-systems-programming/system-call-interfacing.md) — Provides a unified interface for executing low-level operating system calls across different platforms.
- [COM Component Integration](https://awesome-repositories.com/f/operating-systems-systems-programming/com-component-integration.md) — Supports early and late binding for COM objects and generates code from Typelibs. ([source](https://github.com/java-native-access/jna#readme))
- [Component Object Model Handlers](https://awesome-repositories.com/f/operating-systems-systems-programming/component-object-model-handlers.md) — Provides interfaces for invoking registered Windows Component Object Model handlers.
- [COM Integration](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/system-programming-primitives/system-abstractions/os-specific-integration-modules/windows-system-integrations/com-integration.md) — Provides a dedicated toolkit for interacting with Windows Component Object Model objects using early and late binding.
- [Native Crash Protection](https://awesome-repositories.com/f/operating-systems-systems-programming/native-crash-protection.md) — Intercepts memory access errors during native calls to throw exceptions instead of crashing the virtual machine. ([source](http://java-native-access.github.io/jna/5.19.1/javadoc/))
- [Raw Memory Allocation](https://awesome-repositories.com/f/operating-systems-systems-programming/raw-memory-allocation.md) — Allocates contiguous blocks of memory for arrays of structures to be consumed by native functions. ([source](https://github.com/java-native-access/jna/blob/master/www/StructuresAndUnions.md))

### Programming Languages & Runtimes

- [Native Library Integrations](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/foreign-function-interfaces/native-library-integrations.md) — Enables calling functions in shared native libraries from Java without writing custom JNI wrapper code.
- [Function-Pointer Callbacks](https://awesome-repositories.com/f/programming-languages-runtimes/function-pointer-callbacks.md) — Enables mapping Java methods to native function pointers, allowing external libraries to trigger logic within the JVM.
- [Foreign Function Interfaces](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/foreign-function-interfaces.md) — Binds Java method signatures to native symbols in shared libraries across different operating systems.
- [Native Callbacks](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/foreign-function-interfaces/native-library-integrations/native-callbacks.md) — Maps high-level methods to C-style function pointers so native libraries can trigger logic within the runtime. ([source](https://github.com/java-native-access/jna/blob/master/www/CallbacksAndClosures.md))
- [Data Structure Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/native-c-interoperability/data-structure-mappings.md) — Represents C-style structs, nested structures, and arrays to exchange complex data with native libraries. ([source](https://github.com/java-native-access/jna/blob/master/www/FrequentlyAskedQuestions.md))
- [Native Memory Lifecycle Management](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/native-c-interoperability/native-memory-lifecycle-management.md) — Handles pointers, by-reference arguments, and buffers to exchange raw memory blocks between runtime and native layers. ([source](https://github.com/java-native-access/jna#readme))
- [Native Access Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/native-access-libraries.md) — Serves as a comprehensive library for calling native shared libraries from Java without custom JNI glue code.
- [Runtime Symbol Resolution](https://awesome-repositories.com/f/programming-languages-runtimes/compiler-interpreter-internals/linkers/runtime-symbol-resolution.md) — Locates and binds native function addresses within shared libraries using platform-specific loading mechanisms.
- [Direct Native Method Mapping](https://awesome-repositories.com/f/programming-languages-runtimes/direct-native-method-mapping.md) — Binds native library functions to static or instance methods to achieve higher execution performance than standard mapping. ([source](https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md))
- [Dynamic Native Invocation](https://awesome-repositories.com/f/programming-languages-runtimes/dynamic-native-invocation.md) — Enables invoking functions from shared libraries using direct lookups without defining static interfaces. ([source](https://github.com/java-native-access/jna/blob/master/www/DynamicallyTypedLanguages.md))
- [Native String Marshaling](https://awesome-repositories.com/f/programming-languages-runtimes/dynamic-strings/memory-management/string-encoding-converters/native-string-marshaling.md) — Converts strings to NUL-terminated char or wchar_t arrays and copies returned native strings back into the runtime. ([source](http://java-native-access.github.io/jna/5.19.1/javadoc/))
- [Calling Conventions](https://awesome-repositories.com/f/programming-languages-runtimes/function-argument-passing/calling-conventions.md) — Translates interface method signatures into native function names based on platform-specific calling conventions. ([source](https://github.com/java-native-access/jna/blob/master/www/CustomMappings.md))
- [Global Variable Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/native-c-interoperability/global-variable-mappings.md) — Obtains memory addresses of global variables in a native library to read or write their values. ([source](http://java-native-access.github.io/jna/5.19.1/javadoc/))
- [Union Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/native-c-interoperability/union-mappings.md) — Supports defining classes that represent C-style unions and specifying the active field. ([source](https://github.com/java-native-access/jna/blob/master/www/StructuresAndUnions.md))
- [Native Function Pointer Invocations](https://awesome-repositories.com/f/programming-languages-runtimes/native-function-pointer-invocations.md) — JNA supports calling functions referenced by pointers found within native structures by automatically generating proxy wrappers. ([source](https://github.com/java-native-access/jna/blob/master/www/CallbacksAndClosures.md))
- [Native Method Registration](https://awesome-repositories.com/f/programming-languages-runtimes/native-method-registration.md) — Reduces execution overhead by creating optimized code stubs for native methods to avoid runtime reflection. ([source](https://github.com/java-native-access/jna/blob/master/www/FunctionalDescription.md))
- [Native Method Resolution Strategies](https://awesome-repositories.com/f/programming-languages-runtimes/native-method-resolution-strategies.md) — Provides custom mappers to resolve naming mismatches when looking up native function symbols. ([source](https://github.com/java-native-access/jna/blob/master/www/FrequentlyAskedQuestions.md))
- [Native Symbol Mapping](https://awesome-repositories.com/f/programming-languages-runtimes/native-symbol-mapping.md) — Connects method signatures to native symbols using direct name matching or custom mapping for coding conventions. ([source](http://java-native-access.github.io/jna/5.19.1/javadoc/))

### Data & Databases

- [Native Data Marshallers](https://awesome-repositories.com/f/data-databases/data-type-mappings/native-data-marshallers.md) — Converts complex Java objects and structures into contiguous byte buffers matching C-style memory layouts.

### DevOps & Infrastructure

- [JNI Alternatives](https://awesome-repositories.com/f/devops-infrastructure/cicd-pipeline-automation/core-build-engines/build-tooling/native-build-orchestrators/jni-alternatives.md) — Provides a high-level interface for invoking C functions and mapping native data structures as an alternative to JNI.

### Software Engineering & Architecture

- [Method Interception Proxies](https://awesome-repositories.com/f/software-engineering-architecture/method-interception-proxies.md) — Uses dynamic proxy systems to intercept method calls and translate arguments into native memory representations.
- [Native Bridges](https://awesome-repositories.com/f/software-engineering-architecture/native-bridges.md) — Provides a low-level bridge using the Java Native Interface to execute native code without custom wrappers.
- [Reference Argument Passing](https://awesome-repositories.com/f/software-engineering-architecture/reference-argument-passing.md) — Supports passing pointers to types to native functions to capture values updated by the external library. ([source](https://github.com/java-native-access/jna/blob/master/www/ByRefArguments.md))
- [Type Mapping Registries](https://awesome-repositories.com/f/software-engineering-architecture/type-mapping-registries.md) — Maintains a mapping between high-level data types and native representations based on platform calling conventions.

### System Administration & Monitoring

- [Native Callbacks](https://awesome-repositories.com/f/system-administration-monitoring/activity-monitors/asynchronous-activity-completions/native-callbacks.md) — Allows Java methods to be passed as function pointers so native libraries can trigger logic within the runtime.
- [Native Error Retrieval](https://awesome-repositories.com/f/system-administration-monitoring/error-tracking/native-error-retrieval.md) — Captures native error codes from system calls and exposes them as exceptions or numeric values. ([source](http://java-native-access.github.io/jna/5.19.1/javadoc/))

### Part of an Awesome List

- [Mobile Development](https://awesome-repositories.com/f/awesome-lists/devtools/mobile-development.md) — Interface for calling native libraries without JNI.
