Installation Instructions for J/Link 3.1 in Mathematica 4.2 and Later

J/Link is already completely installed in Mathematica 4.2 and later. However, if you want to write your own Java programs that use J/Link, you might want to look at the platform-specific sections below on adding JLink.jar to your CLASSPATH environment variable.

If you are replacing the version of J/Link that came with Mathematica with a newer version that you downloaded from the web, all you need to do is delete the old JLink directory in <Mathematica dir>/AddOns and place the new JLink directory there.

The newest version of J/Link can always be obtained from http://www.wolfram.com/solutions/mathlink/jlink.

Adding JLink.jar to the CLASSPATH environment variable

You do not need to modify your CLASSPATH environment variable for J/Link to function normally. It is simply a convenience for users who want to compile or run Java programs from the command line. 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, such as Borland's JBuilder, do not use the CLASSPATH environment variable to locate classes. You will need to consult the tool's documentation for information.

Microsoft Windows

To set the CLASSPATH on Windows 95 and 98, you can add a line like the following to your autoexec.bat file. The path to your Mathematica directory may be different:

set CLASSPATH=C:\Program Files\Wolfram Research\Mathematica\5.2\AddOns\JLink\JLink.jar;%CLASSPATH%

On Windows NT and 2000, open the Control Panel, select System, click the Environment tab and, in the User Variables section, edit the CLASSPATH variable. Put the full path to JLink.jar at the front, separated from any other components of the CLASSPATH by a semicolon.

On Windows XP, open the Control Panel, select System, click the Advanced tab, then the Environment Variables button and, in the User Variables section, edit the CLASSPATH variable. Put the full path to JLink.jar at the front, separated from any other components of the CLASSPATH by a semicolon.

Restart your computer for the CLASSPATH changes to take effect (on Windows NT, 2000, and XP, you need only restart Mathematica ).

Mac OS X

To set the CLASSPATH, add a line like the following to the .cshrc file in your home directory:

setenv CLASSPATH .:"/Applications/Mathematica 5.2.app/AddOns/JLink/JLink.jar":$CLASSPATH

Linux and UNIX

In csh, the CLASSPATH environment variable is modified with the setenv command. A typical command to put in your .cshrc file might be

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

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

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