I just got Java running on my Raspberry Pi which took a lot more screwing around than i had hoped. I want to be able to read/write data to/from the header pins from Java. How can I do this? Do I need to write a driver or some sort with C first in order to get the data from the header pins? I am running an instance of Soft-float Debian “wheezy." Is this even possible to do in Java? Are there any workarounds that I should know about? Thanks for reading!

2 Answers 2


That should be possible in Java, as referenced here. The library which is used is called rpi-gpio-java and is available at this URL. As stated in the notes, to make it work, please make sure your application is run as root.

Note: Above project rpi-gpio-java is no longer available on google code. Alternate option is PI4J

  • This is interesting. Nice find Dexter.
    – Jivings
    Sep 2, 2012 at 11:52

If you did not already foud your solution, the Pi4J Library, based on Wiring for the Raspberry Pi, offers - also on an early development stage - acces to GPIO, I2C and SPI. And Rs232, not to forget!

Serviceprovider for several IO-boards (Olimex etc.) are included.

Most interesting: Event driven processing (GPIO-Interrupts).

see: here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.