1. Introduction

In the third generation of Lego Mindstorms exist multiple Bricks with compatibility with Sensors & Actuators from Lego Mindstorms ecosystem. This fact is a real software engineering challenge to manage all Bricks, but for that purpose appeared EV3Dev.

EV3Dev provides a Debian Installation for the Bricks and a set of utilities to interact with the hardware in an easy way.

The steps to do in your Brick are:

  • Install a Operating System

  • Install a Java Virtual Machine, JVM

2. Install an Operating System

Previously, we mentioned that EV3Dev provides a Debian image to install in a microSD.

Debian is a Linux Operating System used in millions of computers on the world. This project use Debian delivered by the project EV3Dev which provide a interface to interact with Lego Mindstorms EV3 Brick and other boards compatible like BrickPi & PiStorms.

To install EV3Dev, follow the link to install EV3Dev on your Brick

2.1. Test the installation

Once you have finished the process to install the EV3Dev image on your Brick, try to establish a remote ssh connection. Verify that your Brick has a connection in the same network than your computer

ssh robot@192.168.1.104

And you should the following output

The authenticity of host '10.0.1.2 (10.0.1.2)' can't be established.
ECDSA key fingerprint is SHA256:21hHcnrpfwFMNaZcgeR9b5YnJw7q6Eojt0ZQM83Ephk.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.1.2' (ECDSA) to the list of known hosts.
robot@10.0.1.2's password:
             _____     _
   _____   _|___ /  __| | _____   __
  / _ \ \ / / |_ \ / _` |/ _ \ \ / /
 |  __/\ V / ___) | (_| |  __/\ V /
  \___| \_/ |____/ \__,_|\___| \_/

Debian jessie on LEGO MINDSTORMS EV3!

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

If you connected with your brick then you have completed this process and now you will have a Brick with a complete Linux distro to run any Programming language.

Please, maintain your brick always updated.

Execute the following commands before jump to the next step in this guide.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo reboot now

3. Install Java on your brick

Any Java program run on a JVM (Java Virtual Machine) so, it is necessary to install it. For this step exists 2 paths. One path is for EV3 Brick and another path for BrickPi/PiStorms users.

3.1. EV3 Brick

The EV3 Brick was designed with a SOC based on [ARM EABI](https://wiki.debian.org/ArmEabiPort) and the best JVM option for that hardware architecture is the Oracle JRE 8 to install in the brick but, it is not possible to install directly in the brick without any human interaction, so you need to download from [here](http://www.oracle.com/technetwork/java/embedded/downloads/javase/javaseemeddedev3-1982511.html) and later, copy the file ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz to your brick using the command scp.

Example:

scp "./ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" "robot@192.168.1.85:/home/robot"

Once, you have the file on the brick, you can continue the Java installation with the installer or do yourself manually.

3.1.1. Using the installer

cd /home/robot
mkdir installer
cd installer
wget -N https://raw.githubusercontent.com/ev3dev-lang-java/installer/develop/installer.sh
chmod +x installer.sh
sudo ./installer.sh help
sudo ./installer.sh

3.1.2. Manual way

tar -zxvf "/home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" -C /opt
sudo update-alternatives --install /usr/bin/java java /opt/ejdk1.8.0/linux_arm_sflt/jre/bin/java 1

Now, you have Java on your EV3 Brick

3.2. BrickPi 3 / BrickPi+ / PiStorms

Using the installer, it is possible to automate everything:

cd /home/robot
mkdir installer
cd installer
wget -N https://raw.githubusercontent.com/ev3dev-lang-java/installer/develop/installer.sh
chmod +x installer.sh
sudo ./installer.sh help
sudo ./installer.sh

4. Test your installation

Once you have your bricks with the JVM, test the installation is easy. With the remote connection opened type:

java -version

Now, your Brick is ready to receive your Java programs.