There is a lot of support for Java on Raspberry Pi, Pi will come with Java SE 8 and you can easily use the native interface (because it’s linux and IO’s is mapped as files) but it is much simpler to use the Java ME or PI4J.
There is actually a specific version provided by Oracle for Raspberry Pi which can be found here:
When installed It is simple to use and gives you an easy access to all the I/O’s. It also provide a lot of great libraries to handle communications and other stuff.
Currently the only version is snapshot, but it works really well.
- Export & unexport GPIO pins
- Configure GPIO pin direction
- Configure GPIO pin edge detection
- Control/write GPIO pin states
- Pulse GPIO pin state
- Read GPIO pin states
- Listen for GPIO pin state changes (interrupt-based; not polling)
- Automatically set GPIO states on program termination (GPIO shutdown)
- Triggers for automation based on pin state changes
- Send & receive data via RS232 serial communication
- I2C Communication
- SPI Communication
- Extensible GPIO Provider interface to add GPIO capacity via expansion boards
- Access system information and network information from the Raspberry Pi
- Wrapper classes for direct access to WiringPi Library from Java
You can read more and download the library here: