This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Add-ons & Links / J/Link / Installation /

Linux and Unix

Step 1: Move the JLink directory to the AddOns/Applications directory (Mathematica 4.0 and 4.1 Only)

You need to put the JLink directory in one of two special places. If you want J/Link to be accessible to all users, move the JLink directory to the following location, where <mathematica dir> is the main Mathematica installation directory (typically usr/local/mathematica):

<mathematica dir>/AddOns/Applications

You will probably need root access to move the directory into this location. To make J/Link accessible only to you, you can move the JLink directory to


You will not need root access to do this.

Launch Mathematica and select Rebuild Help Index from the Help menu. This will cause the J/Link User Guide to show up in the Help Browser when you click the Add-ons button.

Step 2 (Optional): Add JLink.jar to your CLASSPATH

If you are going to be writing Java programs that use J/Link (as opposed to only Mathematica programs), and you will be using the java or javac command-line tools, you will probably find it convenient to set up the CLASSPATH environment variable to point to JLink.jar. If you do not set up the CLASSPATH environment variable, then you will have to use the -classpath option every time you compile or run from the command line. Some development tools, notably Borland's JBuilder, do not use the CLASSPATH environment variable to locate classes. You will need to consult the tool's documentation for information.

Adding JLink.jar to your CLASSPATH is required, not optional, if you are using a Java 1.1.x runtime. J/Link will not function correctly unless this is done. However, it is strongly recommended that you simply update to a 1.2 or later version of Java. More information about obtaining an appropriate version of Java can be found in the Obtaining Java section.

To set the CLASSPATH, add a line like the following to the .cshrc file in your home directory (the path will need to be adjusted according to where you installed the JLink directory):

(For Mathematica 4.2 and later)

setenv CLASSPATH /usr/local/Wolfram/Mathematica/5.0/AddOns/JLink/JLink.jar:$CLASSPATH

(For Mathematica 4.0 and 4.1)

setenv CLASSPATH /usr/local/mathematica/AddOns/Applications/JLink/JLink.jar:$CLASSPATH

In sh and ksh, a typical command to put in your .profile file might be:

(For Mathematica 4.2 and later)

CLASSPATH = /usr/local/Wolfram/Mathematica/5.0/AddOns/JLink/JLink.jar:$CLASSPATH


(For Mathematica 4.0 and 4.1)

CLASSPATH = /usr/local/mathematica/AddOns/Applications/JLink/JLink.jar:$CLASSPATH