JNIEasy : Java Native Objects
Last update: 2008 March 31
Java is today a mainstream language, the most popular language perhaps.
Sometimes the Java standard is not enough and your application needs to deal with legacy libraries
(usually developed with C/C++) or use a specific feature of the underlying operating system
or to access to the hardware. JNI, the Java Native Interface, is the stone found when developing
a non-typical CRUD (Create Retrieve Update Delete) application with Java
(usually a desktop application).
JNIEasy is the world's most advanced tool to integrate legacy libraries from Java.
JNIEasy starts a new programming paradigm, the Java Native Objects (JNO),
JNIEasy is a full replacement of the Java Native Interface (JNI)
to integrate Java and C/C++ based libraries and DLLs using Java Only and POJOs (Plain Old Java Object).
JNIEasy avoids the tedious task of bridging
Java and C/C++ code with the complex and error-prone JNI with no C/C++ programming and using
a Java friendly syntax.
JNO is like the transparent persistence paradigm into the integration world:
Transparent Native Programming with Java.
With JNIEasy a normal Java class, with fields and methods, is reflected as a normal C++ class
or C structure and vice versa.
A Java integer, String, array etc is seen as a native integer, string, and array.
No more strange Java artifacts, no more strange and unfriendly Java programming.
To perform this magic, JNIEasy brings to the native integration world the best technique of the
Aspect Oriented Programming: the bytecode enhancement.
JNIEasy helps to use from Java tons of mature and ready-to-use legacy libraries, concentrating
in the business logic, neither in the integration tasks nor reinventing the wheel.
JNIEasy helps to integrate your Java programs with the operating system
leveraging the user experience especially useful with desktop applications
and to access to the underlying hardware.
Using Java only code helps you to achieve your own WORA (Write Once Run Anywhere),
your application can easily decide what platform specific Java code to use.
- Absolutely Java centric
Native programming with JNIEasy is not very much different to normal programming in Java.
This is our maximum priority.
- Direct correspondence between Java basic datatypes and C/C++ datatypes
Examples: Java int with C int,
a String reference with char* or wchar_t*,
a String object with a '\0' ended string,
an Integer reference with int*,
an Integer object with an allocated C int,
a int with a int* or an embedded int C array,
a java.lang.reflect.Method/Constructor/Field reference with a C/C++ method/constructor/field pointer,
a Java class with a C++ class/structure/union including methods and fields
and so on.
- An "inspired" C macro style to define platform dependent names
(DLLs/shared objects can have different names by platform, exported names can have different name manglings)
and sizes (a user defined Java native class can have several native layouts).
Used names and sizes are resolved on runtime.
- Java primitive types can have user defined variable native sizes and alignments:
a Java char can be reflected as a C char, Win32's wchar_t (2 bytes) or Linux/Mac gcc's wchar_t (4 bytes)
- Varargs support to call native methods like C's printf
- Optional or no use of reflection behind the scenes
Direct method calls and field accesses to achieve maximum performance.
- User defined Java POJOs mapping C++ classes including methods (static and instance) and constructors, supporting inheritance
- Normal Java methods can be defined as proxies of native methods or as callbacks callable from native
- Native objects (with native memory allocated) are garbage collected when go out of the scope : no more native memory leaks
- Errors in native code are converted to Java exceptions
- Unlimited number of callbacks
- ANSI and UNICODE support
A String object can be declared to be ANSI or UNICODE in the native memory layout.
- Robust type checking
Native programming with Java more robust than using C/C++.
- Supported stdcall and cdecl calling conventions
- Anonymous union support
Contiguous fields of a Java class working as a C++ class o a structure,
can be declared as forming an union.
- Global, class/structure or field level memory field alignment declaration options
- Prepared to 64 bit architectures with no code changes
Cross-platform options like the Java long data type with platform dependent native memory size.
- Multithread capable
Native methods can be called concurrently, native objects can be accessed concurrently from Java.
- Optional native transactions applied to native memory
- Native objects are serializable and usable out of JNIEasy as normal objects
- Optional Java code generation specially suited to wrap very big DLLs
- Optional bytecode enhancement on the fly loading the class in runtime
- Optimized manipulation of big arrays
- Optional dynamic linking of Java methods from native (C/C++)
without JNI, using a technique similar to Win32's GetProcAddress
A user defined C++ class can easily be defined as a proxy of a Java POJO.
- Optional artifacts to a fine grane native memory manipulation
Requisites / Platforms
JNIEasy works on the following x86-32 platforms: Microsoft Windows (Win32), Linux x86, Mac OS X 10.4 (Tiger)
and Solaris x86. Java code of JNIEasy is compiled with Java SE JDK 1.4 (runs with J2SE 1.5 and upper).
JNIEasy is compiled with Java SE 1.4 but user defined classes can be compiled
with upper versions and programs developed using JNIEasy can use Java SE 1.5 (Java 5) features,
but user defined Java native data types cannot use
Java 5 data types like generics.
JNIEasy can map C/C++ exported methods, structures
and classes, but C++ templates may be exported but not bound to Java generics.
JNIEasy follows a developer friendly license model.
We are developers, we know the problems of typical commercial licensing:
Developers do not like to register to evaluate a tool.
You don't need to give us any data to evaluate JNIEasy,
the framework and the evaluation key can be downloaded with no registry.
Developers do not like to evaluate a product with a specific and definitive time frame,
usually the tool is not needed immediately after this short time.
JNIEasy can be evaluated during 5 days, after
you can download again a new evaluation key.
Developers do not like dirty and hidden registries in their systems.
JNIEasy doesn't modify the Windows registry or a similar technique,
it uses only a special file, the license/key file.
Developers enjoy evaluate new tools with no immediate relationship with
their job and with no immediate commercial objective.
We like you enjoy with our products if they are used with personal and non-profit objectives.
Use our renewable evaluation license.
Developers like to do open source programs, usually commercial tools prohibit this.
JNIEasy has a special runtime/deployment license (JNIEasy.lic file) with no time limit to distribute your open source products based on
Development licenses can not be distributed, the runtime/deployment license is bound to a purchased development license
and only can be distributed with open source products developed by the owner of the related
development license purchased.
Developers like in their jobs quality software with people behind it,
the software cost is not usually a problem (with reasonable prices).
We offer 1 month of free mail support for every per developer commercial license sold.
This support can be extended with an annual mail support contract.
JNIEasy is FREE for personal and non-profit use, using a
5 days evaluation key that can be renewed in this web,
no registry and user data is required.
JNIEasy grants a royalty free license to distribute derivative works using JNIEasy
buying a per developer commercial license. Derivative works must be distributed
using a "deployment key"
Licensing terms are here (version for print).