Using pi4j to control GPIO

37 16613
[COMPILE] gcc -c -O3 -Wall -I/usr/lib/jvm/jdk-7-oracle-armhf/include -I/usr/lib/jvm/jdk-7-oracle-armhf/include/linux -I/usr/local/include -I/usr/local/include/linux -Winline -pipe -L/usr/local/lib /usr/local/lib/libwiringPi.a /usr/local/lib/libwiringPiDev.a  com_pi4j_jni_I2C.c
gcc: error: /usr/local/lib/libwiringPi.a: No such file or directory
make: *** [com_pi4j_jni_I2C.o] Error 1

I have this error on making Pi4J
i reinstalled WiringBP and its works
i intalled RPi.GPIO_BP and its works

I do not know what to do

For this Error I can get you a short tutorial:

First go to wiringbp directory. On my Banana Pi with Rapsian for Banana it is pre installed at /opt/api-lib/WiringBP. Depends on your installation where you locate it.
In WiringBP you find two directories you need. The devLib and the wiringPi.
Switch to devLib and Enter:  
> sudo make static
> make installt-static
repeat this in wiringPi
After these two steps, you should have the missing file.
Now you can try to build your Pi4J again.

Tell us about results, good luck.


I'm new here and need some further help. Read all your posts an get WiringBP and Pi4J installed on my Banana Pi with Raspian for Banana.

Gpio readall works
Gpio export works
Gpio write works

But is I start my Java App with only a single Pin to get high an Error occurs:
"Unable to determine hardware version. I see Hardware: sun7i ´ - expecting BCM2708 or BCM2709. Please report this to

Surly and wrote to the adress. But this is only support for Raspberry Pi.

Can anybody get me some ideas to fix this error?


Hi All,

at least I got it working without the error from last post.
The reason for this Error is PI4J library. It's build, as we all know, for Raspberry. I used Eclipse on a Windows machine to write and build my Java software. I was using the lib from And I exportet my Java software as runnable Jar with the option "Package required libraries into generated JAR" and as well "Extract required libraries into genreated JAR". So far so good. Would be comfortable, if there is not small misstake a made. In the libs I used is wiringPi included. It's the wiringPi for Raspberry Pi. So this couldn't work.
I recompiled an exported the code with the option "Copy required libraries into a sub-folder next to the generated JAR". Ok, this works. The error from the last post is gone.
But it would not be my project if there isn't now another error.
Now I got an UndefinedClassException. My Software can't find class. I bearly can understand it. It's because the I'm using on my windows machine are not on my Banana Pi. But why they aren't there? I've installed pi4j an build it and so on ...
Can anybody tell me, how to get the correct libs on my Banana Pi? Or how to fix this new error another way?

Kind regards,

Hi Guys!

I am the founder of the Pi4J project and I just came across this thread.  I’m glad to see there is interest in using Java and Pi4J on the BananaPi.  

If there is still interest and some of you guys are able to help with testing and providing some insight to the changes needed, I would be happy to look into integrating some custom build options so Pi4J can be compiled directly for the BananaPi platform.  

I have just ordered a BananaPi so I can be better prepared for this platform.

Robert Savage

savageautomate replied at Sun Sep 13, 2015 18:52
Hi Guys!

I am the founder of the Pi4J project and I just came across this thread.  I’m glad to see ...

it`s awesome to see this.
i`m user of raspberry pi 2 and banana pro, on pi2 its works perfectly. i`m here to make testes and give some feedbacks.


Edited by savageautomate at Nov 20, 2015 13:55

Hello Fellow Bananians,

The Pi4J Project now includes support for BananaPi and BananaPro!   

This support has just been added and only cursory tests performed, so lets call it experimental for now, but I welcome you guys to try it out and let me know if you run into any trouble.  You must use the Pi4J v1.1-SNAPSHOT builds until v1.1 gets released.  You can manually download the JARs in ZIP or the installable .DEB package from this page:

Support includes Java programatic access and control of GPIO inputs/outputs, PWM, I2C, SPI, and UART (serial).

There is no documentation yet specifically for the Banana platforms, but apart from a few subtle differences in configuring a platform and pin/bus addressing, its basically the same.  Perhaps better than documentation .. there are a number of examples (sample code) included in the build and available in the GitHub repo specific to each Banana platform:

BananaPi Examples:

BananaPro Examples:

Other notes:  You don't have to install and compile WiringPi/WiringBP seperately!  The Pi4J core JAR includes all the native libraries it needs to communicate with the hardware embeded in the JAR.



savageautomate replied at Nov 20, 2015 13:52
Hello Fellow Bananians,

The Pi4J Project now includes support for BananaPi and BananaPro!   

Thats fantastic news!!!!
Thanks!!! Cant wait to try this, always nice to see people still working on banana pi

You have to log in before you can reply Login | Sign Up

Points Rules