From RepRap
Jump to: navigation, search

HOWTO: Install JavaComm

Note: This page is incomplete, and needs some details filled in


JavaComm is an aysynchronous communications library for Java. It enables a java application to get low level access to the serial port on a PC (under Windows, Linux, etc).

The RepRap host controller is written in Java and currently needs this library installed in order to communicate with the RepRap modules.

Because accessing low level hardware is beyond the capability of a plain old JVM, some specific device driver addons are needed for each operating system. This page describes how to get JavaComm working so you can run the host controller.

Installation on Microsoft Windows

Installation of JavaComm on Windows is very straightforward. Just copy the JavaComm files to your reprap/host/lib directory:

  • comm.jar
  • win32com.dll

Installation on Linux

I don't really recall what I did for this, so let me know if it works or not

There are a few implementations you can use. The one I use successfully is the IBM comm implementation (for use with the IBM JRE).

There's a Linux JavaComm HowTo here.

Here's how I (AdrianBowyer) did it: Go to and go to the download link at the bottom of the page. You will need to register with Sun to get there, but it's free. Download the file There are four files you need from the unzip of that:

  • commapi/jar/comm.jar, and
  • commapi/lib/
  • commapi/lib/
  • commapi/docs/

Put the jar file somewhere in your class path (e.g. somewhere like usr/java/j2sdk/jre/lib/ext), the .so files in java's load-library path (on my system that's in /usr/java/j2sdk/jre/lib/i386), and "somewhere that java can find it" - on my system, that seems to mean creating a symbolic link to it from the directory in which you're running the project, but there must be an easier way.

The Easier Way

The jar file still needs to be put in your Java class path. This is an environment variable called CLASSPATH, and you can add things on to it - or create it if it is not there. You do this by typing export CLASSPATH=$CLASSPATH:/my/new/library/path/blah. To let the Java serial library find, put its path in the class path too. This can all be added to your profile file, typically ~/.bashrc or entered in the "Run" configuration in Eclipse.

There is also an environment variable for the .so libraries called LD_LIBRARY_PATH which is treated in exactly the same way. Add to that the directory that you keep the .so file in. Eclipse has a Run/Environment tab to enter the LD_LIBRARY_PATH variable in, and there is a checkbox that allows you to add it on to any existing LD_LIBRARY_PATH.

WARNING There are comm.jar files out there that do not support the Linux drivers. If in doubt, unzip the comm.jar file (yes, JAR files are really ZIP files) and see if the file ./com/sun/comm/LinuxDriver.class exists. If it doesn't, download a new Linux JavaComm as above.


If you're not running the IBM JRE, you need to install it first. You can have this installed at the same time as the Sun or Blackdown JRE.

Copy the JavaComm files to your reprap/host/lib directory:

  • comm.jar

Copy the JavaComm system files:

  • to jre/bin
  • to jre/lib ???
  • comm.jar to jre/lib/ext ???

Blackdown JRE

This is what I originally tried to get working without success, so I switched to the IBM JRE to get it working. However, it should be possible to make this work too.


Do not use the Sun 1.5.0 JRE, use the JDK instead. The JRE lacks some parts that are called by the 3D library such as the AWT. Ubuntu Linux users note that EasyUbuntu will install the JRE, but you can install the JDK on top of it using the package manager.

-- Main.SimonMcAuliffe - 22 Mar 2006