The Raspberry Pi‘s raspbian image comes with oracle-java8-jdk already installed and I wanted to use this with maven. However if you install maven using apt-get it will install all kinds of other JDKs and things you don’t need. The solution to this is to install maven from it’s binary distribution. This is quite easy as everyhing it needs is already installed.
- Download the Binary tar.gz version the maven website. Pick the latest version.
- Extract the archive to /opt.
cd /opt && sudo tar -xzvf /path/to/apache-maven-3.2.5-bin.tar.gz
- Tell you shell where to find maven. We’ll do this in the system profile settings so it is available to all users.
Quit and save from the editor.
- Log out and back into the Raspberry Pi so the profile script takes effect and there it is. You can test that it is working with
and you should see something like
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /opt/apache-maven-3.2.5
Java version: 1.8.0, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.12.26-rt40+", arch: "arm", family: "unix"