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

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

Microsoft Windows

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

Move the entire JLink directory into the AddOns\Applications directory in your Mathematica directory. Note that there may already be a "stub" JLink directory in AddOns\Applications, which is empty except for a Documentation directory, and exists only to allow an informative announcement about J/Link to show up in the Help Browser before J/Link is installed. You can overwrite the "stub" directory.

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), you will probably find it convenient to set up the CLASSPATH environment variable to point to JLink.jar. This is particularly true if you are using command-line tools to compile or run Java programs. 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.

To set the CLASSPATH on Windows 95 and 98, you can add a line like the following to your autoexec.bat file (enter this as one line; the break below is just due to wrapping). The path to your Mathematica directory may be different.

(For Mathematica 4.2 and later)

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



(For Mathematica 4.0 and 4.1)

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

On Windows NT, 2000, and XP, open the Control Panel, select System, click the Environment tab and, in the User Variables section (called Environment Variables on XP), 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.

If you want to use the Microsoft Java runtime, see the notes for Microsoft Windows under the Obtaining Java section earlier in this User Guide.