Skip to content

Java

The Java bindings are built as two separate pieces:

  • standard JAR file
  • native shared library built from the C++ source

!!! important Java 1.8 or greater is required because of features used in Java bindings

Building the C++ bindings

Use the '-DDNP3_JAVA=ON' option when configuring CMake. CMake will locate your JNI headers using the JAVA_HOME environment variable. The shared library must be installed in a system location or the path specified using the system.library.path JVM option.

Building the JAR

The pure Java part of the bindings is built and installed locally using Maven:

> cd java
> mvn install

You can optionally suppress the integration tests during the build (e.g. if you don't have library installed):

> mvn install -DskipTests

You can now use it in your Maven based Java projects using

<dependencies>
...
    <dependency>
        <groupId>com.automatak.dnp3</groupId>
        <artifactId>opendnp3-bindings</artifactId>
        <version>${opendnp3.version}</version>
    </dependency>
...
</dependencies>