Where is my JRE

From RepRap
Revision as of 11:04, 21 July 2015 by Glenn (talk | contribs) (wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

JRE stands for Java Runtime Environment, and is the set of Java files needed to run Java programs on your system. You can have several JREs installed on a single computer, but only one is set as the active default one at any given time.

It is important to make sure you configure your system to use a Sun JRE, not a GCJ one, because Reprap does not (yet?) work with GCJ.

Why do I care where my JRE directory is?

Where the current JRE is matters when installing external Java libraries such as Java3D and the Java COMM library or rxtx. Installing these in the "wrong" place can either not work at all, or work partly, resulting in hard-to-find problems running the RepRap host software later.

Selecting a JRE

Ubuntu and Debian Linux

Ubuntu 7.04 uses Sun Java 6. Earlier releases will probably use Java 1.5.0 (java-1.5.0-sun) instead of Java 6 (java-6-sun). Either one will work with RepRap. GCJ, which comes with Ubuntu, will not. The commands to find out which JRE or JREs your system has available, and to configure your system to use the one you want are:

sudo update-java-alternatives --list # List what JRE's are installed sudo update-java-alternatives --auto # Set them all to automatic sudo update-java-alternatives --set java-6-sun # Select the one to use, java-6-sun in this example

Other Linux

Details for other Linux distributions wanted... ask in the RepRap forums about this if you are using Fedora or Red Hat Enterprise Linux or some other distribution.

Finding your JRE directory

There is a directory called jre somewhere that has lib and i386 directories under it (i386 is for 32bit Linux on an Intel (or AMD) PC). This is where you cd into before installing external Java library packages such as Java3D. For Debian and Ubuntu, it is under /usr/lib/jvm/ and the command

{| border="1" |- update-java-alternatives --list ||grep java ||grep sun ||cut -d " " -f3 # Output your Sun JRE(s) |}

will show you where that is. There is a jre directory right underneath it.

Note: If the command above outputs more than one line, you have multiple Sun JRE's installed -- either you are a Java expert or you tried to upgrade, or something. Installing just one Sun JRE for RepRap is recommended, unless you really know what you are doing, to reduce confusion.

To verify that you have "found" the right place, cd there and look for an lib/ext directory, for example:

cd /usr/lib/jvm/java-6-sun/jre # This is my JRE directory ls -ld lib/etc # If this exists, I found the right place

Installing external Java libraries in your JRE directory

You need to cd to the jre directory and then (as root or using sudo) run the .bin file from Sun or unpack the .zip file containing the library. Doing this anywhere else will probably not be useful.

{| border="1" |- cd `update-java-alternatives --list ||grep java ||grep sun ||cut -d " " -f3 ||head -1`/jre |}

Above is one way to do it that should work on any Debian/Ubuntu Linux system. More manually (and less typing!), if you already know the directory concerned, you can just do:

cd /usr/lib/jvm/java-6-sun/jre # Works on Ubuntu 7.04; use the right one for your system

Then (as root or using sudo) run the .bin file or unzip the .zip file you just downloaded, for example:

sudo ~/java3d-1_4_0_01-linux-i586.bin # To install the Java3D from a .bin file in your home dir

and

sudo unzip ~/rxtx-2.1-7-bins-r2.zip # If you downloaded the rxtx serial libs to your home dir

Seeking Further Help

If this page is unclear or does not work for you, please ask questions in the RepRap forums, mentioning the WhereIsMyJRE Wiki page in your message.

-- Main.JonathanMarsden - 25 May 2007