Installing leJOS

Sven Köhler Andy Shaw Lawrie Griffiths

Installing leJOS

To install leJOS you will need a blank SD card of at least 2GB and no more than 32GB. SDXC cards are not supported by the EV3 hardware. The card needs to be formatted with a FAT32 partition. We recommend that you use the following program to format the card: https://www.sdcard.org/downloads/formatter_4/ Even if the card is new it is worth using this program as SD cards sometimes have hidden partitions on them which can cause problems with the EV3.

To install leJOS on Microsoft Windows, see [Windows Installation]

If you're using Linux or Mac OS X, then download a file named leJOS_EV3_<version>.tar.gz from the leJOS EV3 download page and unpack it. There is a step by step guide for Mac OS X provided by a leJOS user here: http://www.bartneck.de/2017/06/04/tutorial-on-how-to-install-and-run-java-on-lego-mindstorms-ev3-using-eclipse-on-mac-os-x/

If you are using Eclipse, you can install the Eclipse plugin, and set the EV3_HOME preference
setting to the directory that you unpacked leJOS to (the leJOS home directory).

If you are not an Eclipse user or do not want to use the plugin, see [Using ant build files] for an alternative way to create runnable jar files and upload them to the EV3.

To use the command line tools, you should set the environment variables EV3_HOME to point to the
leJOS home directory and include the bin directory on your PATH.

You can also set LEJOS_EV3_JAVA_HOME if you want leJOS to use a specific version of the JDK.

To use the leJOS samples you should import the samples.zip file into Eclipse.

The development source of leJOS is available in the source.tar.gz file. This only includes the Java
source. To get the source for the SD card Linux system, you should go to the Git ev3sdcard repository.

After you have installed leJOS on your PC, you will need to create an SD card. To do this you need an empty SD card with a FAT32 partition of at least 200MB. The card itself should be at least 1GB and no more than 32GB. SDXC cards are not supported by the EV3 hardware.

If your card does not have a FAT32 partition, you can use a partition utility to reformat it as FAT32, or write the sd500.img file in the sd500.zip file (which is part of the distribution) to the disk as an image file (using dd or a disk image writing utility).

You should then unzip the lejosimage.zip file from the leJOS home directory to the root directory of the card, and download and copy the Oracle JRE .tar.gz file to the card. The file is available at http://java.com/legomindstorms You will need to create a free Oracle account, if you do not have one.

When you have written these files to the card, safely remove it, put it in the EV3 and boot the EV3. leJOS will then reformat your card to have a 500MB FAT32 partition and a Linux ext2 partition using the rest of the card. It will prepare the card for use by leJOS showing you its progress as it goes. This process takes about 8 minutes.

If you are a Windows user, but have trouble with the installer for any reason, you can use the zip distribution instead, and install it manually as described here.


Related

EV3 Wiki: Getting started with leJOS EV3
EV3 Wiki: Using ant build files
EV3 Wiki: Windows Installation

Discussion

  • Ryox

    Ryox - 2015-12-19

    The installation always get stuck on "Installing rootfs" when creating the bootable SD-card with the LeJos utility. To work-around that I had to manually copy sd500.img. See the section about it in the article ("write the sd500.img file in the sd500.zip file (which is part of the distribution) to the disk as an image file (using dd or a disk image writing utility)")

     
    Last edit: Ryox 2015-12-19
    • saul mora perea

      saul mora perea - 2018-03-18

      Dear Ryox, coul you help me with this problem? I have been tryed many times to install the software in the brick and I had not been sucessfull. I would like, it is possible, that you send me the step by step installation. I will be gradfull if you can help me. Thanks in advance. Saúl.

       
      • Frank Bergmann

        Frank Bergmann - 2018-03-18

        Dear Saul,
        as you can see above it is quite different for the OS.
        Which OS are you using?
        Frank

         
        • saul mora perea

          saul mora perea - 2018-03-19

          Hi Frank,

          Thanks in advance for your answer. I have installed LEJOS running on OS Windows 10,
          64 bits. I have followed all the steps in the site https://sourceforge.net/p/lejos/wiki/Home/ until the point where I trayed to install Lejos in the brick. I created SD card and it started to work in the brick, but at the end it finished in the message "Installing rootfs" and that was all. I would like to know what I need in order to do this task in the right way.

          As a new idea to explore, I bought the book "Beginning Robotics Programming in Java with LEGO Mindstorms" and follow the steps to install Lego in the Brick, but and at the end it finished in the same point. I learned that it is necesary to use:
          leJOS_EV3_0.9.1-beta_win32_setup.exe (as installer of Lejos)
          jdk-7u45-windows-i586 (as Java Development Kit)
          ejre-7u60-fcs-b19-linux-arm-sflt-headless-07_may_2014.tar.gz (EV3 Oracle JRE)

          If you want more details in order to help me, let me know it.

          Actually, I want to find my mistake but it has been hard. What can I do?
          I will appreciate if you could help me.

          Thanks again.

           
          • Frank Bergmann

            Frank Bergmann - 2018-03-19

            Hi Saul,
            I started with computers 37 years ago and used many OS through all those years but unfortunately Windows was not part of this OS crowd. ;-)
            Basically these are the steps I successfully used on Linux:
            1. unzip SD500 image
            2. write image to card
            3. mount card (means on all modern OS Windows, Linux and OS X to "insert it")
            4. in mounted card directory unzip lejosimage.zip
            5. copy Java to mounted card directory
            6. cleanly unmount/eject card
            (see also my post below from 2017-02-20)
            The difference to your description is that I used a different Java: From December instead of May 2014:
            ejre-7u75-fcs-b13-linux-arm-sflt-headless-18_dec_2014_armv5.tar.gz
            Maybe you should give that a try.
            After unpacking/copying the files on your card should look on the card FS like shown in my post. Maybe a comparison can help you.
            sincerely,
            Frank

             
          • Andrea Schafferhans

            Hi Saul,
            we recently did the installation using a Mac. When we used a 32Gb SD card we couldn't get this to work, no matter how we formatted the card or copied the data. Based on some hints on the web, we then just got a 8Gb SD card and it instantly worked. So, maybe that fix works for you, too?
            Good luck!
            Andrea

             
            • saul mora perea

              saul mora perea - 2018-03-19

              Hi Andrea,
              I have already installed Lejos on the brick.
              Anyway I appreciate your comentes an support.
              Saúl

               
  • Frank Bergmann

    Frank Bergmann - 2017-02-20

    example linux installation:

    unzip sd500.zip 
    cat sd500.img >/dev/sdb
    cd /run/media/*/SD500/
    unzip /home/*/ev3/leJOS_EV3_0.9.1-beta/lejosimage.zip
    cp -af /home/*/ev3/ejre-7u75-fcs-b13-linux-arm-sflt-headless-18_dec_2014_armv5.tar.gz .
    

    After that the FS looks like this:

    ls -l
    total 63660
    -rw-r--r--. 1 abcdef abcdef      792 Nov 15  2015 boot.scr
    -rw-r--r--. 1 abcdef abcdef 33545828 Dec 22  2014 ejre-7u75-fcs-b13-linux-arm-sflt-headless-18_dec_2014_armv5.tar.gz
    drwxr-xr-x. 4 abcdef abcdef     4096 Nov 15  2015 lejos
    -rw-r--r--. 1 abcdef abcdef 20084268 Nov 15  2015 lejosimage.bz2
    -rw-r--r--. 1 abcdef abcdef  9417944 Nov 15  2015 rootfs.cpio.gz
    -rw-r--r--. 1 abcdef abcdef  2117928 Nov 15  2015 uImage
    -rw-r--r--. 1 abcdef abcdef       11 Nov 15  2015 version
    

    Then put sd card in ev3 and let it do the final setup.

    Checking java version (after setup by ev3):

    ( cd /run/media/*/*/home/root/lejos/../../..;qemu-arm -cpu arm926 -L . home/root/lejos/ejre*/bin/java -version ; )
    java version "1.7.0_75"
    Java(TM) SE Embedded Runtime Environment (build 1.7.0_75-b13, headless)
    Java HotSpot(TM) Embedded Client VM (build 24.75-b04, mixed mode, sharing)
    
     
    Last edit: Frank Bergmann 2017-02-20
  • Andrea Schafferhans

    On MacOS Sierra (10.12.6 ) we had problems connecting to the brick via USB after the installation. Here is what we had to do to solve this:
    Apparently the leJOS needs to connect as an RNDIS/Ethernet Gadget.
    Starting with 10.12, RNDIS is included in the OS, so you do not have to install HoRNDIS (http://www.joshuawise.com/horndis) any more.
    However, we had to explicitly add this as an additional interface in the Network Preferences (possibly because the account we were on was a protectd children's account?).
    We also set "Configure IPv6" to Link-local only on the TCP/IP tab in advanced settings (following what we found on https://raspberrypi.stackexchange.com/questions/64112/macos-not-discovering-raspberry-pi-zero-as-an-usb-ethernet-device).

    -- Hope this helps others who run into the same problem.

     

Log in to post a comment.