Building Java bindings for ADLX

This guide outlines the steps to build a Java binding wrapper for ADLX, a prerequisite to programming with ADLX in a Java application.

Prerequisite(s)

  • ADLX SDK is installed.

  • Visual Studio 2019 is installed.

  • swigwin 4.0.2 is installed, and the path to the swigwin 4.0.2 installation is added to the Path user environment variable.

  • OpenJDK 17 is installed.

  • The path to the OpenJDK 17 installation is added to the JAVA_HOME system environment variable.

  • The bin path for the OpenJDK 17 installation is added to the Path system environment variable.

To build ADLX bindings in Java

  1. Create and name a folder for your Java ADLX binding wrapper, for example ADLXJavaBind.

  2. Create a new file in the ADLXJavaBind folder and title it ADLXJavaBind.i.

  3. Edit ADLXJavaBind.i and add the SDK header files for the interfaces you wish to wrap by using the SWIG input format.To create bindings for event notifications, turn on director wrapping callback for the respective listener interfaces.

    For example,

    Copied!

    feature("director") IADLXDisplayListChangedListener;

    Note: Refer to the Java samples ADLXJavaBind.i file for an example of a Java binding.

  4. Create a C++ Dynamic Link Library project named ADLXJavaBind and configure the project as follows:

    • Key

      Value

      Observations

      VC++ Directories > Include Directories

      $(JAVA_HOME)/include and $(JAVA_HOME)/include/win32

      Add path of java include and path of java/win32 include

      C/C++ > Precompiled Header

      Not Using Precompiled Headers

      Do not use precompiled headers

  5. Add the ADLXJavaBind.i file to the project.

  6. Right-click the ADLXJavaBind.i file and select Properties from the menu. In the Properties dialog select Configuration Properties> General> Item Type> Custom Build Tool.

    Set the configuration as follows:

    • Key

      Value

      Observations

      Command Line

      if not exist $(SolutionDir)out mkdir $(SolutionDir)out swig.exe -c++ -java -package out -outdir ../out/ ADLXJavaBind.i

      Invoke SWIG.exe to build ADLXJavaBind.i file

      Outputs

      %(Filename)_wrap.cxx

      Set output file name format

  7. Build the project.

    Result: The following files are added to the ADLXJavaBind project output folder:

    • ADLXJavaBind_wrap.h file.

    • ADLXJavaBind_wrap.cxx file.

    • Several *.java files.

  8. Add the following files to the project:

    • ADLXJavaBind_wrap.h

    • ADLXJavaBind_wrap.cxx

    • SDK/Platform/Windows/WinAPIs.cpp

    • SDK/ADLXHelper/Windows/Cpp/ADLXHelper.h

    • SDK/ADLXHelper/Windows/Cpp/ADLXHelper.cpp

  9. Rebuild the project.

    Result: The ADLXJavaBind.dll is built in the "$(SolutionDir)$(Platform)$/(Configuration)/" folder.