User Tools

Site Tools


generic_java_binding

Description:

  • Generalize Java API from Android specific to general Java Platforms including J2SE.
  • Allows Java development on any OS (i.e. Linux, Windows, Android, and etc.) not limited to Android

Milestone:

IoTivity Release 1.3.0

Currently Target: May 2017

Directory organization changes:

New directory:

Notice:

The jni code is no longer built using Android.mk build files. It is built using scons.

Due to the folder reorganization there are changes to multiple build scripts to address the new folder paths.

How to build the generic-java code:

Android

No change. It builds using the same build instructions as before.

Android Build Instructions

Linux:

  1. Ordered List ItemSpecify JAVA_HOME environment variable with the path to the JDK. (i.e. `export JAVA_HOME=/usr/lib/jvm/java-1.8.0/`)
  2. Ordered List Item`scons BUILD_JAVA=1` #add any additional build options or `autobuild.py linux_unsecured_with_java` or `autobuild.py linux_secured_with_java`

Running Linux samples:

  # only need to export LD_LIBRARY_PATH if java.library.path is not specified
  $ export LD_LIBRARY_PATH=$(pwd)/out/linux/x86_64/debug/:$LD_LIBRARY_PATH
Run SimpleServer:
  $ cd <ouput_dir>/java
  $ java -Djava.library.path=.. -jar simpleserver.jar
Run SimpleClient:
  $ cd <ouput_dir>/java
  $ java -Djava.library.path=.. -jar simpleclient.jar

For 1.3.0 release and older:

Run SimpleServer:
  $ java -cp java/examples-java/simpleserver/build/libs/simpleserver.jar:java/iotivity-linux/build/libs/iotivity-linux.jar org.iotivity.base.examples.SimpleServer
Run SimpleClient:
  $ java -cp java/examples-java/simpleclient/build/libs/simpleclient.jar:java/iotivity-linux/build/libs/iotivity-linux.jar org.iotivity.base.examples.SimpleClient

Windows:

Due some unexpected failures on Android the Windows build of Java is currently disabled. See https://jira.iotivity.org/browse/IOT-2405 to find out if it has been re-enabled.

  1. Specify JAVA_HOME environment variable with the path to the JDK. (i.e. `set JAVA_HOME=c:\Progra~1\Java\jdk1.8.0_131`) Important the JAVA_HOME path can not contain any spaces.
  2. `run build -java -noSecurty` #add any additional build options

Running Windows samples:

SimpleServer Build:
  $ cd <ouput_dir>/java
  $ java -Djava.library.path=.. -jar simpleserver.jar
SimpleClient Build:
  $ cd <ouput_dir>/java
  $ java -Djava.library.path=.. -jar simpleclient.jar

IoTivity Projects, Functions, and Maintainers:

generic_java_binding.txt · Last modified: 2018/05/09 18:51 by George Nash