Jaw
 

 

What it is

JAW is a framework based on the Java Native Interface (JNI) to integrate C++ code in Java applications

No knowledge of JNI is required

Special support for integration of third party DLL libraries in Java, like drivers for realtime data acquisition modules

 

 
 

Concept

JAW is a frameworks with an underlying proxy pattern. In JAW a Java class and its methods have a close correspondence to the native C++ class and their methods. JAW uses but hides the JNI mechanism by defining two wrapper classes NativeHandler for Java and WindowHandler for C++. A typical JAW application uses an instance of NativeHandler and derives from WindowHandler. No knowledge of JNI is required, but a basic knowledge of C++ is necessary, due to the fact that the user of JAW must edit and build the native DLL with a C++ IDE, typically with Microsoft's Visual Studio.

Features

  • Hides the internal mechanism of JNI, no native Java methods and no JNI C functions needed
  • Native code runs in a separate native (high priority) thread that is transparent to the user
  • Easy creation of visible or semi-transparent native windows with simple access to its event loop by registering specific messages
  • Data transfer between primitive Java instance variables and C++ with templates eliminates type casts
  • Data transfer between Java strings and array with C++ templates
    Support for Unicode, MBCS and UTF-8 strings
  • Callbacks of Java methods with C++ templates
  • Native FIFO buffer for streaming data transfer from C++ to Java
  • Designed to integrate third party DLL libraries into Java, e.g. drivers for realtime measurement devices (National Instruments, Keithley, etc.)
  • Error handling by callbacks or returning error codes rather than throwing exceptions
  • Unnecessary to use javah to generate C header files.

Restrictions

  • No support for the Java invocation API (dynamic creation of a JVM, classes and methods)
  • No support for data transfer via Java static fields
  • Only available for the Windows operating system
  • Because the DLLs use some resources from the Visual C distribution,
    installation of Microsoft Visual C++ Redistributable Package may be
    necessary