SOLVED - Gpio installation

can’t get gpio to work, don’t understand these instructions:

Manual installation without using apt-repo:

Extract openhab-runtime archive to /opt/openhab (recommended) if not done yet, copy following JARs from openhab-addons archive to /opt/openhab/addons folder:

org.openhab.io.gpio
org.openhab.binding.gpio

Install native JNA library version 3.2.7, modify /opt/openhab/start.sh and append -Djna.boot.library.path=/usr/lib/jni right after java on the last line of the file as change /usr/lib/jni with the path to JNA library’s parent directory.

I intalled gpio - binding, should Iinstall the ‘io’ binding?
Should I install native JNA library, and how?
(I use the raspberry pi)

  1. you have to move both org.openhab.io.gpio and org.openhab.binding.gpio to addons folder.
  2. you have to modify the file /opt/openhab/start.sh
    If there isn’t any - it’s in the openhab root folder, so where did you install openHAB?

Within start.sh find the line starting with java -Dosgi.clean=true, there you have to append -Djna.boot.library.path=/usr/lib/jni after the word java and before any other statement.
If the lines are like

java \
-Dosgi.clean=true \

you can integrate the line according:

java \
-Djna.boot.library.path=/usr/lib/jni \
-Dosgi.clean=true \

If you are using another way to start openHAB automatically, e.g. a Script which starts openHAB instead of start.sh, you have to append the appropriate statement there, too.

thx, very clear explanation,
but I don’t have a folder ‘jni’ in usr/lib
should I install something?

I already did this:

sudo apt-get install libjna-java

I used this command to load openhab on startup:

sudo update-rc.d openhab defaults

and in the file etc/init.d/openhab there is written:

DAEMON=/usr/bin/java
DAEMON_ARGS="-Djna.boot.library.path=/usr/lib/jni -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0 -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.port=$HTTP_PORT -Djetty.port.ssl=$HTTPS_PORT -Djetty.home=. -Dlogback.configurationFile=configurations/logback.xml -Dfelix.fileinstall.dir=addons -Djava.library.path=lib -Djava.security.auth.login.config=./etc/login.conf -Dorg.quartz.properties=./etc/quartz.properties -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar $cp $* -console "
PIDFILE=/var/run/$DAEMON_NAME.pid

. /lib/lsb/init-functions

do_start() {
log_daemon_msg "Starting system $DAEMON_NAME daemon"
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --chdir $ROOT_DIR --exec $DAEMON – $DAEMON_ARGS
log_end_msg $?
}

As explained in the tutorial on homeautomationforgeeks

If there is no folder /usr/lib/jni then maybe apt installed it another place.

I found a folder called ‘jni’ in /usr/lib/arm-linux-gnueabihf/
with only this file in it : ‘libjnidispatch.so’

as read somewhere-else on the forum this is it

Got them working,
don’t know how but I think it involves pointing to the folder
/usr/lib/arm-linux-gnueabihf/jni/

thx @Udo_Hartmann

I have same problem with my openhab with raspberry pi3, I’m not able to get the simple on/off to work on the GPIO led light. How you fix it? I follow the instruction and nothing seems to work.
Thanks,
Stanly

I have a rb2, but project in’t activeren anymore. Sorry