From RepRap
Revision as of 10:00, 26 September 2012 by Felipe.sanches (talk | contribs) (Java Development Kit (JDK) / Java Runtime Environment (JRE))
Jump to: navigation, search

This page describes something which is no longer the most recent version. For the replacement version see: DriverSoftware#Installation

Installing the RepRap software under Linux or Unix

RepRap uses a large number of open-source software packages for development, and quite a few when it runs. This page describes how to take a standard Ubuntu installation and prepare it for RepRap use. It then describes how to download and set up all the RepRap software. It should be easy to adapt the descriptions below for other Unix systems.

To do most of the following work it is useful to have two windows open on your computer:

  • A terminal window,
  • A web browser with this page displayed.

Note that for many of these installations you will need the superuser (root) password for your machine. You can copy-and-paste the commands below into the terminal window. Be careful what you run as the superuser, (or via su or sudo ) especially if you are not a Unix expert - you can damage your system with an ill-judged command... avoid typos.

In what follows, sudo is used whenever superuser priviledges are needed.


RepRap's controlling software is written in Java, and also the Art of Illusion design package for three dimensional objects uses it, so next we need a Java development environment. The following method of getting one should be clean, in that it is easy to separate it from any Java that you already have on your system.

Note: You might as well install a full JDK not just the smaller JRE, in case you decide to help develop the RepRap software once you are familiar with it.

Java Development Kit (JDK) / Java Runtime Environment (JRE)

Sun's JRE is proprietary software. You should get Art of Illusion to work perfectly well using OpenJDK-JRE, a free software implementation of the Java Runtime Environment. Please report to the OpenJDK development team any issues that might force you to install the proprietary JRE from Sun/Oracle.

Install and configure the openjdk-7-jre package. Copy/paste the following commands into your terminal window (do not copy the leading =$= which represents the prompt from your shell!):

$ sudo apt-get install openjdk-7-jre $ sudo update-java-alternatives --set java-7-openjdk

If sudo asks you for your password, type it in! Now you have a working Java runtime, ready to rock.

Java3D - 3D graphics in Java

The host RepRap software uses three-dimensional graphics to allow you to interact with the RepRap machine, so you need a copy of Java3D to permit that to work. Click on that link and download the appropriate file for your machine into your home directory; for Linux on a PC that file will be called something like java3d-1_5_1-linux-i586.bin.

Then, cd to the Java run-time environment (JRE) directory, then run the downloaded file via sudo. If you haven't already done so, to quickly download 1.5.1, then run it:

$ cd ~ ; wget $ cd /usr/lib/jvm/java-5-sun/jre # This is your JRE directory, adjust if necessary $ sudo sh ~/java3d-1_5_1-linux-i586.bin

This will add extra files to your Java lib directory where Jave will be able to find them. If you have problems, check the README in the download folder, and see WhereIsMyJRE.

The 3D utility library

J3D is a set of libraries to make various things easier with the Java3D API. We use their STL Loader.

$ cd ; wget $ unzip $ cd /usr/lib/jvm/java-5-sun/jre # This is your JRE directory, adjust if necessary $ sudo cp ~/j3d-org-java3d-all.jar lib/ext/

RXTX Serial Library - serial-port communications

The host computer (that is, the computer on which you're installing all this software) talks to the RepRap machine using either an RS232 serial port (/dev/ttyS0 or /dev/ttyS1 on most machines) or via a USB-to-serial converter (/dev/ttyUSB0). Most laptops and some desktop PCs don't have a serial interface, so - if you have one of those - you will need to buy such a converter; they normally only cost a few pounds. (RepRap 2.0 "Mendel" will be driven directly via USB.)

Java, therefore, needs to know how to talk to these serial interfaces. Fortunately, there is a Java API that implements this.

RepRap now uses the RXTX serial libraries. The current version of them being used is 2.1.7-r2; there is a package for Ubuntu users, but don't bother installing it - java won't find the files.

Check the RXTX site to see if there is a newer one at the time you read this, and download the appropriate Linux binary .zip file, currently [[1]]. Save this file in your home directory. Now unzip the three files you need from it:

 $ cd ; wget
 $ unzip -j -o rxtx-2.1-7-bins-r2/RXTXcomm.jar rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/*.so

Now (via sudo) copy those files underneath your JRE so Java will find them. In this example your JRE directory is /usr/lib/jvm/java-5-sun/jre. See WhereIsMyJRE.

 $ JREDIR=/usr/lib/jvm/java-5-sun/jre  # Use your own JRE location
 $ sudo cp -vp ~/RXTXcomm.jar $JREDIR/lib/ext/
 $ sudo cp -vp ~/librxtx*.so $JREDIR/lib/i386/

For Ubuntu 10.04 in combination with java-6-openjdk ([2])

 $ cd ; wget
 $ unzip -j -o rxtx-2.1-7-bins-r2/RXTXcomm.jar rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/*.so
 $ sudo cp /usr/lib/
 $ sudo cp /usr/lib/
 $ sudo cp RXTXcomm.jar /usr/lib/jvm/java-6-openjdk/jre/lib/

Granting yourself permissions on your serial ports

Finally, ordinary users may not have access to the serial port(s) on your machine. So, add yourself to the dialout group (in Ubuntu), or (on another Linux distribution) take whatever other action you need to so you can access those devices.

{| border="1"
 $ sudo moduser -G `groups ||sed 's/ /,/g'`,dialout `whoami`

Notes for Non-Ubuntu Linux: A more manual approach is to edit your groups database by hand, perhaps by
 $ sudo vigr -s

or similar. The moduser approach should work in both Debian and Ubuntu, and may also work in Red Hat based Linux distributions like Fedora and RHEL and CentOS. Serial port permissions are very distribution specific, so if you have issues with them, please read the documentation for your distribution carefully for clues.

RepRap Host Software

Now you are ready to download and run the RepRap Host software! Simply navigate to the SourceForge download page using your web browser, and choose the most recent version (0.9 as of 28 May 2008). Download that, and then unzip it wherever you like (your home directory is fine). The easiest way to run it, is to double click the file and at the prompt, either select 'run in terminal (for debug text)' or 'run'.

Alternatively, you could run this command from the directory that contains the host software:

$ cd ~/reprap-host-0.8.1 # If you unzipped it in your home dir and are using version 0.8.1 $ ./

An alternative is using the latest code from the SVN version controlled repository: $ sudo apt-get install subversion # Installs it on Ubuntu, if you don't already have this $ cd $ svn co reprap-host $ cd reprap-host/ $ ./

After a short load period, you will see this initial screen:


This is a representation of the build-base of the RepRap machine. You will load objects to be made here, move them to where you want them built, then build them.

For the moment experiment with the tilt, zoom and pan controls (left, middle and right mouse buttons respectively). There is a .zip file full of STL files you can load into your Reprap host software, downloadable from Sourceforge. Some of the larger ones there will not yet "print" in your Reprap host software, though -- try out smaller the ones first.

It Didn't work!

Sorry. We've found a few gnarly problems involving mismatched versions of this and that. Here are a few pointers: --- Annoyingly, if you have an Nvidia graphics card on your system, a bug in the Nvidia drivers may become aparent here, and the software will give a Java exception rather than giving you graphics. To fix that, see here. --- If you get: Exception in thread "main" java.lang.UnsupportedClassVersionError: org/reprap/Main (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass( at ...

You're probably not using a recent version of Java. On Ubuntu this is often because the wrong one is selected as default, particularly if you have confirmed that Sun Java 5 is really installed (using "java -version" will tell you what's actually running). You can fix this with: sudo update-java-alternatives -s java-1.5.0-sun --- Hopefully we've found your problem. If not, we welcome details on fixes that you have found.


You have now installed the RepRap Host software, and with the proper machinery, you are ready to get printing! This is just the surface of the software need to actually develop for the project. At this early stage, its unlikely that you will be able to get by with just the host software. Follow the instructions below to install and setup your complete development environment.

Development Software Installation

This is for the extra stuff that most people won't need. 3D modeling, circuit board layout/design, java compiling, firmware compiling, etc. Here there be dragons. As well as a lot of fun ;)