diff --git a/samples/java_sample/README.md b/samples/java_sample/README.md index e4342329..994db768 100644 --- a/samples/java_sample/README.md +++ b/samples/java_sample/README.md @@ -63,24 +63,38 @@ Creating a Java module is easy: ```json { - "module name": "<>", - "module path": "<>", - "args": { - "class_path": "<>", - "library_path": "<>", - "class_name": "<>", - "args": <>, - "jvm_options": { - "version": <>, - "debug": [true | false], - "debug_port": <>, - "verbose": [true | false], - "additional_options": [ - "<>" - ] + "loaders": [ + { + "type": "java", + "name": "java", + "configuration":{ + "jvm.options":{ + "library.path": "<>", + "version": <>, + "debug": [true | false], + "debug_port": <>, + "verbose": [true | false], + "additional_options": [ + "<>" + ] + } + } + } - } - } + ], + "modules": [ + { + "name": "<>", + "loader":{ + "name": "java", + "entrypoint": { + "class.name": "<>", + "class.path": "<>" + } + }, + "args": <> + } + } ``` According to [Java documentation](https://docs.oracle.com/javase/tutorial/essential/environment/paths.html) one may also set the CLASSPATH environment @@ -92,16 +106,30 @@ Creating a Java module is easy: ```json { - "jvm_options": { - "version": 4, - "debug": false, - "debug_port": 9876, - "verbose": false, - "additional_options": null - } + ... + "jvm.options": { + "library.path": "<>", + "version": 5, + "debug": false, + "debug_port": 9876, + "verbose": false, + "additional_options": null + } + ... } ``` + **Note:** The default search locations are as follows: + + On Windows: + + %PROGRAMFILES%\azure_iot_gateway_sdk-{version}\lib\modules\java_module_host.dll + %PROGRAMFILES(x86)%\azure_iot_gateway_sdk-{version}\lib\modules\java_module_host.dll + + On Linux: + + /usr/local/lib/modules/java_module_host.so + **Note:** Since the JVM is only loaded once, the full classpath must be set and be the same across all module in a configuration. Similar to the "jvm_options" section, if the classpath differs across configuration, creation will fail. diff --git a/samples/java_sample/java_devbox_setup.md b/samples/java_sample/java_devbox_setup.md index 0080a4b4..9aeb8898 100644 --- a/samples/java_sample/java_devbox_setup.md +++ b/samples/java_sample/java_devbox_setup.md @@ -6,7 +6,6 @@ This document describes how to prepare your development environment to use the * - [Maven 3](#installmaven) - [Azure IoT Gateway SDK for Java](#installgw) - [Build from source](#installgwsource) - - [Include using Maven](#installgwmaven) - [Application Samples](#samplecode) @@ -112,29 +111,11 @@ Open a command prompt and use the following commands for the steps above: The compiled JAR file with all dependencies bundled in can then be found at: ``` -{IoT gateway SDK root}/bindings/java/gateway-java-binding/target/gateway-java-binding-{version}-with-deps.jar +{IoT gateway SDK root}/bindings/java/gateway-java-binding/target/gateway-java-binding-{version}.jar ``` When you're ready to build your own module in Java, include this JAR file in your project to get the interfaces and classes that you need. - -### Get the Java binding for the Azure IoT Gateway SDK from Maven (as a dependency) -_This is the recommended method of including the Azure IoT Gateway SDK in your project, however this method will only work if your project is a Maven project_ - -_For a guide on creating a maven project, see here: https://maven.apache.org/guides/getting-started/ _ - -- Navigate to http://search.maven.org, search for **com.microsoft.azure.gateway** and take note of the latest version number (or the version number of whichever version of the sdk you desire to use). - -In your main pom.xml file, add the Azure IoT Gateway SDK Java binding as a dependency using your desired version as follows: -``` - - com.microsoft.azure.gateway - gateway-java-binding - 1.0.0 - - -``` - ## Sample applications