Can't get GPIO working rpi2

So I think I’ve done everything correctly, but I’m at a loss.
When openhab starts up and loads my items file it says:

2016-03-04 04:47:40.905 [INFO ] [runtime.busevents ] - Motion1 state updated to OPEN
Exception in thread “openHAB GPIO event listener (pin 7)” java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at org.openhab.io.gpio.linux.LibC.(LibC.java:54)
at org.openhab.io.gpio.linux.GPIOPinLinux$EventListener.run(GPIOPinLinux.java:652)

I copied the addons:
org.openhab.io.gpio
org.openhab.binding.gpio

i added this to start.sh:
Djna.boot.library.path=/usr/lib/jni

I have this in openhab.cfg:
gpio:sysfs=/sys
gpio:debounce=10

I have this in my item configuration:
Contact Motion1 “LR Motion” (Internal){ gpio=“pin:7 activelow:yes” }

in the instructions on the wiki it says to install native jna 3.2.7, but there doesn’t seem to be any instruction for this, does anyone know what I’m missing here?

I looked at the logs a bit more and noticed this:
2016-03-04 05:24:36.053 [ERROR] [.o.b.gpio.internal.GPIOBinding] - Error occured while creating backend object for item Motion1, exception: Device or resource busy

Put this somewhere near the top of your start.sh script ::

echo 7 > /sys/class/gpio/unexport

Not 100% sure, but i think this will fix your issue.

regards
Espen

Thanks, but This didn’t work for me, any other ideas?

Check user permissions, either run openhab as root or add openhab to the gpio group. If using Jessie you should probably also checkout this thread: https://community.openhab.org/t/raspian-jessie-gpio-input

thanks it worked for me

you can even add force:yes in the item defination