Skip to content

LuceS/pi4j-arch

 
 

Repository files navigation

========================================================================== Pi4J: Java library for Raspberry Pi

Project information

Project website: http://www.pi4j.com/
Project discussion group: https://groups.google.com/forum/#!forum/pi4j
Project issues list: https://github.com/Pi4J/pi4j/issues

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

How to build Pi4J on Arch Linux

  1. Prepare your Raspberry Pi (Running Arch linux):

     > sudo pacman -S git-core make gcc libtool jdk7-openjdk
    
  2. Install WiringPi on your Raspberry Pi:

     > git clone git://git.drogon.net/wiringPi
     > cd wiringPi
     > ./build
    
  3. Test the WiringPi install:

     > gpio -v
     > gpio readall
    
  4. Set JAVA_HOME on your default profile:

     > sudo vim  /etc/profile
     
     export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
    
  5. Set JAVA_HOME for your default environment. This is needed when Maven will connect with the Raspberry Pi over SSH.

     > sudo vim  /etc/environment
    
     export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
    
  6. Clone this repository:

     > git clone https://github.com/glnds/pi4j-arch
    
  7. Adjust the pom.xml

     > cd pi4j-arch
     > vim pox.xml
    
     ...
     <!-- DEFAULT RASPBERRY PI PROPERTIES -->
     <pi.host>192.168.1.1</pi.host>
     <pi.port>22</pi.port>
     <pi.user>root</pi.user>
     <pi.password>root</pi.password>        
     ...
    
  8. Install Maven: http://maven.apache.org/

  9. Build Pi4J:

     mvn clean install -P native -P hard-float
    

Important note: currently, the script only works when executed by the root user. If you want to run it under a different user, you will have to grant the user root privileges and suppress its need to provide a password. I've not tested it but probable you have to setup your user like this:

> sudo visudo

...
user    ALL=(ALL) NOPASSWD: ALL
...

You will also have to do some minor adjustments to the build.xml file.

This build procedure is based on the original build instruction of Pi4J.

Install Pi4j on Arch Linux

  1. If not yet downloaded, download the Arch build here (or use your own build).

  2. Copy the Pi4J library to your Raspberry pi:

     > scp pi4j-0.0.5.tar.gz pi@rpi.local:~/
    
  3. Extract the archive:

     > tar -xvzf pi4j-0.0.5.tar.gz
    
  4. Intall the libraries:

     > sudo mkdir /opt/pi4j
     > sudo mv ~/pi4j-0.0.5/lib/ /opt/pi4j/
     > sudo mv ~/pi4j-0.0.5/examples/ /opt/pi4j/
    

Done! You can now use Pi4J on your Raspberry Pi running Arch Linux. Here's an example:

sudo java -cp SomeJar.jar:.:classes:/opt/pi4j/lib/'*' be.pixxis.Example

About

Java library for Raspberry Pi running Arch Linux

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 89.4%
  • C 9.0%
  • Other 1.6%