Overview - Java Access to ADU Devices

Java applications access a Windows DLL by using a JNI (Java Native Interface) wrapper. The JNI wrapper is a C program that converts Java calls into C calls.

This demo includes sample programs for the java application (AduJava.java) and the JNI wrapper (AduJava.c). The AduHid.dll library is provided by Ontrak Control Systems Inc as a binary file.

The run-time component of AduJava.java is the compiled byte codes in AduJava.class. The run-time component of AduJava.c is the AduJava.dll library. The following diagram shows how the source code relates to the run time components.

The AduJava example was created as follows:

  1. The AduJava.java main program is typed in using a text editor.
  2. The javac compiler converts the AduJava.java source code into AduJava.class byte codes.
  3. The javah tool creates the AduJava.h JNI header file.
  4. A text editor was used to create the AduJava.c source code file for the JNI wrapper.
  5. A C compiler creates the AduJava.dll wrapper library.
  6. The java launcher runs the AduJava application.

Here is a graphic of the files, tools and their relationships.



  • The editor can be any ASCII text editor such as Notepad.exe. You use it to type in the Java code for the application and the C code for the JNI wrapper.
  • AduJava.java contains the source code for the java program.
  • javac is the java compiler provided in the Java SDK. It reads the source code in AduJava.java and creates the byte codes in AduJava.class.
  • AduJava.class contains the compiled byte codes for the AduJava.java program.
  • javah is the JNI header file generator provided in the Java SDK. It reads the byte codes in the class file and generates a header file containing the prototypes for the JNI wrapper functions.
  • AduJava.h contains the prototype declarations for the entry points into the wrapper library.
  • AduJava.c contains the source code for the wrapper library. You refer to the contents of the AduJava.h and AduHid.h files when you create this code.
  • The compiler is a standard C compiler used to create the AduJava.dll wrapper library.
    (Note: For this demo I am including the linker as part of the compiler).
  • AduHid.lib tells the linker the locations of the AduHid functions within the AduHid.dll.
  • AduJava.dll contains the executable binary for the wrapper library.
  • AduHid.dll contains the executable binary for the ADU device controller. This file is provided as binary only by Ontrak Control Systems Inc.

  • Other Files

    Some other files are provided as part of the demo.

  • AduHid.h contains the declarations for the entry points into the AduHid.dll library. Refer to this file to find the functions signatures needed to create the AduJava wrapper.
  • setpath.bat contains a command to set the path to your java installation.
  • compile.bat contains the commands to compile and link the wrapper library.


  • AduJava Help File Version 1.0.0.0
    Copyright 2005 Ontrak Control Systems Inc.