0

I'm trying to run Iotivity Simple Clent in Java. I have cloned Iotivity project https://github.com/iotivity/iotivity and I have created an eclipse project that includes all the required Iotivity Java classes plus the classes for the SimpleClient from java-examples folder and I have no error so far.

When I try to run SimpleClient.java I get

Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocstack-jni in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.iotivity.base.OcPlatform.<clinit>(OcPlatform.java:39)
    at org.iotivity.base.examples.SimpleClient.startSimpleClient(SimpleClient.java:75)
    at org.iotivity.base.examples.SimpleClient.main(SimpleClient.java:524)

I have installed SCONs and Gradle but I don't know how to proceed in order to build and create the "ocstack-jni" or any other library that is required to be loaded. My operating system is Windows 10.

bloox
  • 127
  • 2
  • 9

1 Answers1

1

You need to build with BUILD_JAVA=1 and the JAVA_HOME environment var must not be pointing to your current java install.

  • Sorry but I didn't understand what I should do. Should I first try to generate somehow the ocstack-jni library first before I build Java? – bloox Jul 24 '17 at 07:19
  • 1
    @bloox you need to go to the root folder of iotivity and run scons with the parameters adapted to your computer (see iotivity build guide) and with BUILD_JAVA parameter enabled –  Jul 24 '17 at 11:53
  • I was able to build project using BUILD_JAVA=1 as you are saying. I also found these instructions very helpful [link](https://wiki.iotivity.org/generic_java_binding). I had to work with VS 2015 though because with VS 2017 I was experiencing problems (couldn't recognize cl) Thank you Luis! – bloox Jul 25 '17 at 14:54