Installation Instructions for J/Link 3.1
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.
The newest version of J/Link can always be obtained from
http://www.wolfram.com/solutions/mathlink/jlink.
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.
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.0\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.0.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.0/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.0/AddOns/JLink/JLink.jar:$CLASSPATH
export CLASSPATH
Installation Instructions for J/Link 3.1
in Mathematica 4.0 and 4.1
The newest version of J/Link can always be obtained from
http://www.wolfram.com/solutions/mathlink/jlink.
If you have an older version of J/Link installed, delete
the JLink directory
in <Mathematica dir>/AddOns/Applications (or
wherever you installed it), and delete all old copies
of JLink.jar, wherever they might reside on your system. In
particular, if you installed an old version of JLink.jar into
your Java installation's jre/lib/ext directory, delete
it. JLink.jar should not be installed there. Leave it
inside the JLink directory.
Microsoft Windows
Step 1: Move the JLink directory to
the AddOns\Applications directory
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 under the Add-ons & Links tab.
The User Guide has information about what versions of Java are
supported, and how to obtain Java for your platform.
Step 2 (Optional): Add JLink.jar
to your CLASSPATH
NOTE: The location of JLink.jar within
the JLink directory structure was changed in the 2.1
release. Users of previous versions with CLASSPATH
specifications that point at JLink.jar will need to revise
them. JLink.jar is now in the JLink directory
itself, not JLink/SystemAdditions.
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. The path to
your Mathematica directory may be different:
set CLASSPATH=C:\Program Files\Wolfram Research
\Mathematica\4.1\AddOns\Applications\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.
Mac OS X
Step 1: Move the JLink directory to
the AddOns/Applications directory
Move the entire JLink directory into the following location,
where <home directory> is your home directory
(typically something like /Users/myusername):
<home directory>/Library/Mathematica/4.1/AddOns/Applications
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 under Add-ons & Links.
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.
To set the CLASSPATH, add a line like the following to the
.cshrc file in your home directory:
setenv CLASSPATH .:~/Library/Mathematica/4.1/AddOns
/Applications/JLink/JLink.jar:$CLASSPATH
Linux and Unix
It is strongly recommended that you obtain the most up-to-date version
of Java you can (1.4.x as of the time of this writing). See the
section Obtaining Java in the User Guide for information about
obtaining the latest Java for your platform. To determine what version
of Java you have, execute java
-version
from a command line.
Step 1: Move the JLink directory to
the AddOns/Applications directory
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 into 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 do this. To make J/Link
accessible only to you, you can move the JLink dir
into
~/.Mathematica/4.1/AddOns/Applications
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 & Links tab.
Step 2 (Optional): Add JLink.jar to
your CLASSPATH
NOTE: The location of JLink.jar within
the JLink directory structure was changed in this
release. Users of previous versions with CLASSPATH
specifications that point at JLink.jar will need to revise
them. JLink.jar is now in the JLink directory
itself, not JLink/SystemAdditions.
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.
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
~/.Mathematica/4.1/AddOns/Applications/JLink/JLink.jar:$CLASSPATH
In sh and ksh, typical commands to put in your .profile file
might be:
CLASSPATH = ~/.Mathematica/4.1/AddOns/Applications/JLink/JLink.jar:$CLASSPATH
export CLASSPATH
|