• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H08-Feb-2021-6257

ant-tools-src/com/sun/jna/H08-Feb-2021-662336

contrib/H08-Feb-2021-184,64971,270

dist/jnacontrib/H03-May-2022-

lib/H03-May-2022-65

native/H03-May-2022-96,77171,261

nbproject/H08-Feb-2021-108101

parent/H08-Feb-2021-553454

src/com/sun/jna/H08-Feb-2021-14,4588,188

test/com/sun/jna/H08-Feb-2021-13,72810,746

www/H08-Feb-2021-1,328998

.classpathH A D08-Feb-2021477 109

.gitattributesH A D08-Feb-2021232 109

.gitignoreH A D08-Feb-2021505 3333

.projectH A D08-Feb-2021382 1817

.travis.ymlH A D08-Feb-20211.2 KiB3528

AL2.0H A D08-Feb-20219.9 KiB178150

CHANGES.mdH A D08-Feb-2021113.2 KiB1,2281,056

LGPL2.1H A D08-Feb-202123.8 KiB459386

LICENSEH A D08-Feb-2021697 2315

OTHERSH A D08-Feb-20211.2 KiB3431

README.mdH A D08-Feb-202113 KiB182134

TODOH A D08-Feb-202114.1 KiB287254

appveyor.ymlH A D08-Feb-20212.3 KiB7363

build-ant-tools.xmlH A D08-Feb-2021770 2020

build.xmlH A D03-May-202274.1 KiB1,6681,440

checkstyle.xmlH A D08-Feb-2021996 2826

checkstyle_suppressions.xmlH A D08-Feb-2021311 108

pom-jna-platform.xmlH A D08-Feb-20211.8 KiB6254

pom-jna.xmlH A D08-Feb-20211.5 KiB5447

README.md

1![Java Native Access - JNA](https://github.com/java-native-access/jna/raw/master/www/images/jnalogo.jpg "Java Native Access - JNA")
2
3[![Github Actions Build Status](https://github.com/java-native-access/jna/workflows/Java%20CI/badge.svg)](https://github.com/java-native-access/jna/actions?query=workflow%3A%22Java+CI%22)
4[![Travis Build Status](https://travis-ci.org/java-native-access/jna.svg?branch=master)](https://travis-ci.org/java-native-access/jna)
5[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/j6vmpjrw5iktb8iu/branch/master?svg=true)](https://ci.appveyor.com/project/dblock/jna-gsxuq/branch/master)
6
7Java Native Access (JNA)
8========================
9
10The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/5.7.0/javadoc/).  Please read the [overview](http://java-native-access.github.io/jna/5.7.0/javadoc/overview-summary.html#overview_description).  Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).
11
12JNA provides Java programs easy access to native shared libraries without writing anything but Java code - no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes.
13
14JNA allows you to call directly into native functions using natural Java method invocation. The Java call looks just like the call does in native code. Most calls require no special handling or configuration; no boilerplate or generated code is required.
15
16JNA uses a small JNI library stub to dynamically invoke native code. The developer uses a Java interface to describe functions and structures in the target native library. This makes it quite easy to take advantage of native platform features without incurring the high overhead of configuring and building JNI code for multiple platforms.  Read this [more in-depth description](https://github.com/java-native-access/jna/blob/master/www/FunctionalDescription.md).
17
18While significant attention has been paid to performance, correctness and ease of use take priority.
19
20In addition, JNA includes a platform library with many native functions already mapped as well as a set of utility interfaces that simplify native access.
21
22Projects Using JNA
23==================
24JNA is a mature library with dozens of contributors and hundreds of commercial and non-commercial projects that use it.  If you're using JNA, feel free to [tell us about it](http://groups.google.com/group/jna-users).  Include some details about your company, project name, purpose and size and tell us how you use the library.
25
26- [Apache Cassandra](http://cassandra.apache.org): Large-scale NoSQL data store.
27- [Rococoa](https://github.com/iterate-ch/rococoa): Java bindings to the Mac OS X Cocoa framework, by Duncan McGregor.
28- [jna-posix](https://github.com/jenkinsci/jna-posix): Common POSIX Functions for Java.
29- [JNAerator](https://github.com/nativelibs4java/JNAerator): Pronounced "generator", auto-generates JNA mappings from C headers, by Olivier Chafik.
30- [Freedom for Media in Java](https://github.com/jitsi/fmj) by Ken Larson/Dieter Krachtus.
31- [GStreamer-Java](https://github.com/gstreamer-java/): Java bindings and utilities for [GStreamer 1.x](https://gstreamer.freedesktop.org/).
32- [VLCJ](https://github.com/caprica/vlcj): Java bindings for libVLC.
33- [SVNKit](http://svnkit.com): Pure Java Subversion client library.
34- [OmegaT Computer-Aided Translation](https://omegat.org/).
35- [IntelliJ IDEA](https://www.jetbrains.com/) by JetBrains.
36- [Apache NetBeans IDE](https://netbeans.apache.org/) by Apache Software Foundation.
37- [FileBot Media Renamer](http://www.filebot.net) by Reinhard Pointner.
38- [USB for Java](https://launchpad.net/libusb4j) by Mario Boikov.
39- [Waffle](https://github.com/dblock/waffle): Enables SSO on Windows in Java applications, by Daniel Doubrovkine.
40- [leveldb-jna](https://github.com/protonail/leveldb-jna): Cross-platform JNA based adapter for [LevelDB](https://github.com/google/leveldb) (used in [Keylord](http://protonail.com)).
41- [bolt-jna](https://github.com/protonail/bolt-jna): Cross-platform JNA based adapter for [Bolt](https://github.com/boltdb/bolt) (used in [Keylord](http://protonail.com)). It is show how to use JNA for binding to Go library.
42- [JVM OpenVR Bindings](https://github.com/kotlin-graphics/openvr).
43- [Apache Ignite](https://ignite.apache.org/): Direct IO plugin
44- [Domino JNA](https://github.com/klehmann/domino-jna): Cross-platform access to HCL Notes/Domino C API methods from Java
45- [OSHI](https://github.com/oshi/oshi): Cross-platform Operating System and Hardware Information library for Java
46- [jAlbum](https://jalbum.net): Desktop based web gallery software for any web site.
47- [jacknji11](https://github.com/joelhockey/jacknji11): Provides a Java PKCS#11 interface.
48- [JNAJack](https://github.com/jaudiolibs/jnajack): Java bindings for [JACK Audio Connection Kit](https://jackaudio.org/).
49
50*Interesting Investigations/Experiments*
51
52- [Drive Lego Mindstorm NXT](http://epirsch.blogspot.com/2008/02/jna-love-nxt.html) by Emmanuel Pirsch.
53- [Detect User Inactivity](http://ochafik.free.fr/blog/?p=98) by Olivier Chafik.
54
55There are also a number of examples and projects within the `contrib` directory of the JNA project itself.
56
57Supported Platforms
58===================
59JNA will build on most linux-like platforms with a reasonable set of GNU tools and a JDK.  See the native [Makefile](https://raw.githubusercontent.com/java-native-access/jna/master/native/Makefile) for native configurations that have been built and tested.  If your platform is supported by [libffi](http://en.wikipedia.org/wiki/Libffi), then chances are you can build JNA for it.
60
61Pre-built platform support may be found [here](https://github.com/java-native-access/jna/tree/master/lib/native).
62
63Download
64========
65
66Version 5.7.0
67
68JNA
69---
70
71[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna/5.7.0/jar) [jna-5.7.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.7.0/jna-5.7.0.jar) [jna-5.7.0-jpms.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.7.0/jna-5.7.0-jpms.jar)
72
73This is the core artifact of JNA and contains only the binding library and the
74core helper classes.
75
76JNA Platform
77------------
78
79[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna-platform.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna-platform/5.7.0/jar) [jna-platform-5.7.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.7.0/jna-platform-5.7.0.jar) [jna-platform-5.7.0-jpms.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.7.0/jna-platform-5.7.0-jpms.jar)
80
81This artifact holds cross-platform mappings and mappings for a number of commonly used platform
82functions, including a large number of Win32 mappings as well as a set of utility classes
83that simplify native access. The code is tested and the utility interfaces ensure that
84native memory management is taken care of correctly.
85
86See [PlatformLibrary.md](https://github.com/java-native-access/jna/blob/master/www/PlatformLibrary.md) for details.
87
88Features
89========
90
91* Automatic mapping from Java to native functions, with simple mappings for all primitive data types
92* Runs on most platforms which support Java
93* Automatic conversion between C and Java strings, with customizable encoding/decoding
94* Structure and Union arguments/return values, by reference and by value
95* Function Pointers, (callbacks from native code to Java) as arguments and/or members of a struct
96* Auto-generated Java proxies for native function pointers
97* By-reference (pointer-to-type) arguments
98* Java array and NIO Buffer arguments (primitive types and pointers) as pointer-to-buffer
99* Nested structures and arrays
100* Wide (wchar_t-based) strings
101* Native long support (32- or 64-bit as appropriate)
102* [Demo applications/examples](https://github.com/java-native-access/jna/tree/master/contrib)
103* Supported on 1.4 or later JVMs, including JavaME (earlier VMs may work with stubbed NIO support)
104* Customizable marshalling/unmarshalling (argument and return value conversions)
105* Customizable mapping from Java method to native function name, and customizable invocation to simulate C preprocessor function macros
106* Support for automatic Windows ASCII/UNICODE function mappings
107* Varargs support
108* Type-safety for native pointers
109* VM crash protection (optional)
110* Optimized direct mapping for high-performance applications.
111* COM support for early and late binding.
112* COM/Typelib java code generator.
113
114Community and Support
115=====================
116
117All questions should be posted to the [jna-users Google group](http://groups.google.com/group/jna-users). Issues can be submitted [here on Github](https://github.com/java-native-access/jna/issues).
118
119When posting to the mailing list, please include the following:
120
121* What OS/CPU/architecture you're using (e.g. Windows 7 64-bit)
122* Reference to your native interface definitions (i.e. C headers), if available
123* The JNA mapping you're trying to use
124* VM crash logs, if any
125* Example native usage, and your attempted Java usage
126
127It's nearly impossible to indicate proper Java usage when there's no native
128reference to work from.
129
130For commercial support, please contact twalljava [at] java [dot] net.
131
132Using the Library
133=================
134
135* [Getting Started](https://github.com/java-native-access/jna/blob/master/www/GettingStarted.md)
136* [Functional Description](https://github.com/java-native-access/jna/blob/master/www/FunctionalDescription.md).
137* [Mapping between Java and Native](https://github.com/java-native-access/jna/blob/master/www/Mappings.md)
138* [Using Pointers and Arrays](https://github.com/java-native-access/jna/blob/master/www/PointersAndArrays.md)
139* [Using Structures and Unions](https://github.com/java-native-access/jna/blob/master/www/StructuresAndUnions.md)
140* [Using By-Reference Arguments](https://github.com/java-native-access/jna/blob/master/www/ByRefArguments.md)
141* [Customization of Type Mapping](https://github.com/java-native-access/jna/blob/master/www/CustomMappings.md)
142* [Callbacks/Function Pointers/Closures](https://github.com/java-native-access/jna/blob/master/www/CallbacksAndClosures.md)
143* [Dynamically Typed Languages (JRuby/Jython)](https://github.com/java-native-access/jna/blob/master/www/DynamicallyTypedLanguages.md)
144* [Platform Library](https://github.com/java-native-access/jna/blob/master/www/PlatformLibrary.md)
145* [Direct Method Mapping](https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md) (Optimization)
146* [Frequently Asked Questions (FAQ)](https://github.com/java-native-access/jna/blob/master/www/FrequentlyAskedQuestions.md)
147* [Avoiding Crashes](http://java-native-access.github.io/jna/5.7.0/javadoc/overview-summary.html#crash-protection)
148
149Primary Documentation (JavaDoc)
150===============================
151
152The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/5.7.0/javadoc/).
153
154Developers
155==========
156
157* [Contributing to JNA](https://github.com/java-native-access/jna/blob/master/www/Contributing.md)
158* [Setting up a Windows Development Environment](https://github.com/java-native-access/jna/blob/master/www/WindowsDevelopmentEnvironment.md)
159* [Setting up an Android Development Environment](https://github.com/java-native-access/jna/blob/master/www/AndroidDevelopmentEnvironment.md)
160* [Setting up a RaspberryPi Development Environment](https://github.com/java-native-access/jna/blob/master/www/RaspberryPiDevelopmentEnvironment.md)
161* [Setting up a Mac Development Environment](https://github.com/java-native-access/jna/blob/master/www/MacDevelopmentEnvironment.md)
162* [Releasing JNA](https://github.com/java-native-access/jna/blob/master/www/ReleasingJNA.md)
163* [Publishing to Maven Central](https://github.com/java-native-access/jna/blob/master/www/PublishingToMavenCentral.md)
164
165Contributing
166============
167
168You're encouraged to contribute to JNA. Fork the code from [https://github.com/java-native-access/jna](https://github.com/java-native-access/jna) and submit pull requests.
169
170For more information on setting up a development environment see [Contributing to JNA](https://github.com/java-native-access/jna/blob/master/www/Contributing.md).
171
172If you are interested in paid support, feel free to say so on the [jna-users mailing list](http://groups.google.com/group/jna-users). Most simple questions will be answered on the list, but more complicated work, new features or target platforms can be negotiated with any of the JNA developers (this is how several of JNA's features came into being). You may even encounter other users with the same need and be able to cost share the new development.
173
174License
175=======
176
177This library is licensed under the LGPL, version 2.1 or later, and (from version 4.0 onward) the Apache Software License, version 2.0. Commercial license arrangements are negotiable.
178
179*NOTE: Oracle is not sponsoring this project, even though the package name (com.sun.jna) might imply otherwise.*
180
181
182