- 1 Downloading and installing the RepRap software under Linux or Unix
- 1.1 Initial packages
- 1.2 Java
- 1.3 The RepRap Java programs
- 1.4 3D graphics in Java
- 1.5 Picp, Gpicp and <noautolink>PiKdev</noautolink>
- 1.6 Developer Documentation
Downloading and 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 an Ubuntu installation and prepare it for RepRap development. It then describes how to download and set up all the RepRap software
When I wrote this page I took a Ubuntu Linux PC and set it up, logging everything I did. The only packages loaded when I started were X Windows and associated software that Ubuntu installs when you ask it to build a desktop environment. 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.
Then you can copy-and-paste the commands below into the appropriate terminal window. Note that for many of these installations you will need the admin password for your machine.
Here is the list of packages we will install, linked to their home pages:
- minicom (for talking directly to serial ports)
- gputils (GNU PIC microcontroller utilities)
- subversion (version control)
- libsdl (multimedia library needed by Kicad below)
- Qt (needed by Pikdev below)
- KDEbase (needed by Pikdev below)
- KiCad (for designing circuits and board layouts)
- JDK (to develop in Java)
You may find that your Linux distribution already has some or all of these installed. The reason for that list is that everything on it can be very simply added to a Debian system using the Synaptic Package Manager (Applications -> System tools -> Synaptic Package Manager); that will handle where all the files go - for this section you don't need to worry about that. Just copy and paste these one by one into the search option and mark them for installation:
minicom (for serial port testing / communication)
gputils (various tools for PIC programming)
subversion (just select subversion - other things it needs will be fetched automatically)
libsdl (select libsdlx.y.dev - the development files for the current version: x.y)
libqt3-mt-dev (development libraries for QT)
kdebase-dev (development libraries for KDE)
libgtk-java (development libraries for GTK+)
libgcj7-awt (development libraries for the AWT toolkit)
then click on "Apply".
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.
Java Development Kit (JDK) on Ubuntu
Install the sun-java6-jdk package as the sun-java6-jre package does not contain all the bits needed to build the RepRap applications.
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives --set java-6-sun
If you see errors involving "gij" or "gcj" it may be necessary to run:
sudo update-alternatives --config java
to replace the GNU Java environment with the Sun one.
If Ubuntu's Sun Java packages are installed as above, do not do the Generic Linux install detailed below.
Java Development Kit (JDK) on Generic Linux
Go to the Sun Java Downloads Page. To start with you want The J2SE Java Runtime Environment (JRE). Click on the "Accept Licence" button (you can even read the licence, if you like, but remember: Life Is Short...), then click on the Linux self-extracting file (which will be called something like j2re-1_4_2_13-linux-i586.bin; the numbers will change as the versions change) and save it as a file in your home directory.
Next, as the superuser, create a directory to put Java downloads in and move the file you just got into it:
# cd /usr/local
# mkdir Java
# cd Java
# mv ~your-id/j2re-1_4_2_13-linux-i586.bin . (Don't forget the . !)
Where your-id is your user ID on your system, and the j2re-1_4_2_13-linux-i586.bin file is the one you just downloaded.
Make sure the file is executable, then run it:
# chmod +x j2re-1_4_2_13-linux-i586.bin
This will ask you to genuflect before the licence (again), and will then extract the files into a subdirectory that will end up being called something like /usr/local/Java/j2re1.4.2_13.
Finally, the file /usr/local/Java/j2re1.4.2_13/bin/java needs to be in the search path for executables. The simplest way to do this is to create a symbolic link to it from /usr/local/bin:
# cd /usr/local/bin
# ln -s /usr/local/Java/j2re1.4.2_13/bin/java
Eclipse: the Java development platform
Installing Eclipse on Ubuntu
Ubuntu provides Eclipse as a maintained package, which means things get updated and upgraded as part of the automatic maintenance processes. Install it using the package manager, or with the following command line typed at a console:
sudo apt-get install eclipse
If Ubuntu's Eclipse package is installed as above, do not do the Generic Linux install detailed below. You will however need to do the Subclipse install.
Installing Eclipse on Generic Linux
Next you need the Eclipse Java development platform. Follow the Download link from that page. This should be smart enough to spot what sort of computer you are on, and to give you the option of downloading the Eclipse SDK 3.2.1 for Linux (the numbers may change if they're up to a different version). Click on that, and then on a mirror site that is geographically close to you. Save the resulting compresed tarball (which will be called something like eclipse-SDK-3.2.1-linux-gtk.tar.gz) in your home directory.
Next, as the superuser once more, move the file to the /usr/local/Java directory and unpack it:
# cd /usr/local/Java
# mv ~your-id/eclipse-SDK-3.2.1-linux-gtk.tar.gz .
# tar -xvzf eclipse-SDK-3.2.1-linux-gtk.tar.gz
This will create a subdirectory under /usr/local/Java called eclipse and put lots of files in it.
The file /usr/local/Java/eclipse/eclipse needs to be run to get Eclipse working, but it likes to be in its own directory when it does so. Consequently type the following:
# cd /usr/local/bin
# cat > eclipse
Finish with <CTRL> C on a new line. This is a little shell script that moves to where you need to be then runs Eclipse. Note that the # before the exclamation mark is part of the file.
Finally make sure it has the right permissions:
# chmod +x eclipse
To test it, as you (not the superuser) just type the eclipse command, which will run the script you just created:
This should produce a blue I-am-starting-up window, then ask you if you want to create a workspace in your home directory (say yes), then give you the development platform window.
Subclipse: version control under Java
All of RepRap is maintained under the Subversion version-control system. This allows easy updating of source code, and also roll-back to previous versions should that be needed. The section of Subversion that works in Eclipse is called Subclipse, and it installs itself from within Eclipse.
First, run eclipse as root (to install Subclipse system-wide):
# sudo eclipse
Then, follow the instructions on the Subclipse webpage, then close eclipse.
Note: In Step 6 of those instructions, be careful to only select Subclipse, not any other plugins such as Mylar which may be visible on that screen.
Note: If you are behind a firewall or use an HTTP proxy server you may need to configure Eclipse so that it knows about that before you install Subclipse. In Eclipse go to the menu: Window -> Preferences -> Install/update and enter the location of the HTTP proxy machine on your network and its port number (usually 3128, but check with your network manager if you are not sure about this). If you are a private individual on broadband you should have a direct connection and this won't be needed.
The RepRap Java programs
Now (finally...) you can download part of the RepRap project - all the RepRap Java source code.
As you (not the superuser) run eclipse.
In Eclipse go to the menu: Window -> Open Perspective -> Other... and you will get a menu containing (among other things) SVN Repository Exploring. Select that and click on OK. It should open a window called SVN Repository. Right mouse click in that window and select New -> Repository location.
Type the URL for the RepRap project at SourceForge:
You may be asked to accept an encryption signature, and it will then enter the main part of the RepRap project in the SVN Repository window.
If you open this (the little triangle on the left) you will see all the sections of the RepRap project. Select reprap then host, right-mouse-click, and select checkout. It will ask you if you want to put this in Reprap in your main workspace (say yes), and it will then download all the RepRap software for driving the RepRap machine from your computer as a host.
Top right in the Eclipse window is a tag that says SVN (this is telling you that you are using Subversion at the moment) and a >> symbol. Click on that >> symbol and select Java. This takes you back to the Java language view, in which you should now have installed the RepRap host software. Open it up; the source code is under src. Explore...
You still can't run the RepRap software yet because you haven't got...
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 appropraite file for your machine into your home directory; for Linux on a PC that file will be called something like java3d-1_4_0_01-linux-i586.bin. Note that, at the time of writing, Java3D version 1.5 does not work with the rest of the software, so you will need to click the previous versions link on the Sun site. Version 1.4.0.01 definitely works.
Then, as the superuser, move the file to your Java directory, cd to the Java run-time environment (JRE) directory, then run the downloaded file:
# cd /usr/local/Java
# mv ~your-id/java3d-1_4_0_01-linux-i586.bin .
# chmod +x java3d-1_4_0_01-linux-i586.bin
# cd j2re1.4.2_13 ### Your JRE directory
This will add extra files to your Java lib directory where Eclipse will be able to find them. If you have problems, check the README in the download folder, and see WhereIsMyJRE.
Now you can run the RepRap software. As you, not the superuser, open Eclipse, open the RepRap project, go to src -> org.reprap and right-mouse-click on Main.java. Select Run as -> Java application. This should open a window that looks like this:
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).
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 see the following error when running the RepRap GUI:
java.lang.UnsupportedClassVersionError: javax/vecmath/Tuple3d (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) ...
Then you should upgrade your Java to Java 1.5 or better.
Picp and Gpicp are a couple of small utilities for dealing with PIC programming, and so it's useful to have them. You can install them via your linux distribution's package manager, i.e. "apt-get install picp gpicp" for Debian and Ubuntu, "emerge picp gpicp" for Gentoo, or "rpm --install picp gpicp" for Redhat and SuSE.
If you wish to install them by hand, click on that link and download the files:
(as usual, the numbers may differ if the version has been updated). As the superuser, make a directory for them, and install them:
# cd /usr/local
# mkdir PIC
# cd PIC
# mv ~your-id/picp-0.6.8.tar.gz .
# mv ~your-id/gpicp-0.1.1.tar.gz .
# tar -xvzf picp-0.6.8.tar.gz
# tar -xvzf gpicp-0.1.1.tar.gz
This will create directories picp-0.6.8 and gpicp-0.1.1 and put the files in them. To build them do:
# cd picp-0.6.8
# make install
# cd ../gpicp-0.1.1
# make install
To test them, as you (not the superuser) type:
You should get a window containing a table of hexadecimal zeros (what will be programmed into the PIC) with a menu bar across the top.
PiKdev is another suport package for the PIC microcontroller.
It is easiest if you simply follow the instructions on their site.
Run the command pikdev.
This should open the <noautolink>PiKdev</noautolink> window. It may complain about lack of permission on your serial and/or parallel ports, in which case do what it says.
!! Congratulations! You now have the entire RepRap project on your computer plus all the software needed to build it, to run it, and to modify it.
This is for the extra stuff that most people wont need. Circuit boards, firmware compiling, etc.