Skip to main content

Getting started with the emnify Java SDK

Installation

The emnify Java SDK is open source and the source code is available on GitHub.

To install the SDK, add the emnify dependency to your existing project and use build automation tools, like Maven or Gradle, or install it manually.

info

Regardless of the package manager you are using, you need to specify the latest version of the emnify Java SDK. The following installation examples use SDK_VERSION where this should be specified.

Prerequisites

Supported Java versions

TLS requirements

Refer to the SSL Report table for the supported Transport Layer Security (TLS) versions.

Install with Maven

Use the following dependency in your project to grab via Maven:

    <dependency>
<groupId>com.emnify.sdk</groupId>
<artifactId>emnify</artifactId>
<version>SDK_VERSION</version>
</dependency>

Replace SDK_VERSION with the version of the emnify Java SDK you're using.

Install with Gradle

Use the following to add the emnify dependency to your project via Gradle:

    implementation group: "com.emnify.sdk", name: "emnify", version: "SDK_VERSION"

Replace SDK_VERSION with the version of the emnify Java SDK you're using.

Install manually

If you want to compile it yourself, here's how:

    git clone git@github.com:emnify/emnify-sdk-java.git
cd emnify-sdk-java
mvn install # Requires Maven

If you want to build your own .jar, execute the following from within the cloned directory:

  mvn package

Configuration

Environment variables

To store configuration settings, like an application token or a base URL, use environment variables instead of hardcoding them in your application. Here are some examples:

NameDescription
EMNIFY_BASE_PATHBase URL to form a request. Default value: https://cdn.emnify.net
EMNIFY_APPLICATION_TOKENVariable for authenticating via an application token.
EMNIFY_USERNAME and EMNIFY_PASSWORDVariables for authenticating via username and password.

Explore more

If you're new to IoT connectivity and emnify, start by learning some common terminology and concepts and explore some use cases that show what the SDK is capable of.

Also, see the emnify System Documentation and our OpenAPI specification.