External Interfaces |
Using a Different Version of the Java JVM
MATLAB ships with one specific version of the Java Virtual Machine (JVM) and uses this version by default with the MATLAB interface to Java. This section describes how to download and select a version other than the default.
Note MATLAB is only fully supported on the JVM that it ships with. Some components may not work properly under a different version of the JVM. |
To change the JVM version that MATLAB uses, follow these steps:
When you have enabled a different version of the JVM, you can verify that MATLAB is using this version by entering the version -java
command documented in the previous section.
Download the JVM Version You Want to Use
You can download the Java Virtual Machine from the Web site http://java.sun.com/j2se/downloads.html.
If you are using Linux, go to the Web site http://www.blackdown.org/java-linux/mirrors.html, and choose the version required by your processor.
Locate the Root of the Run-time Path for this Version
To get MATLAB to use the version you have just downloaded, you must first find the root of the run-time path for this JVM, and then set the MATLAB_JAVA
environment variable to that path. To locate the JVM run-time path, find the directory in the Java installation tree that is one level up from the directory containing the file rt.jar
. This may be a subdirectory of the main JDK install directory. (If you cannot find rt.jar
, look for the file classes.zip
.)
For example, if the JDK is installed in D:\jdk1.2.1
on Windows and the rt.jar
file is in D:\jdk1.2.1\jre\lib
, you would set MATLAB_JAVA
to the directory one level up from that: D:\jdk1.2.1\jre
.
On UNIX, if the JDE is installed in /usr/openv/java/jre/lib
and the rt.jar
is in /usr/openv/java/jre/lib
, set MATLAB_JAVA
to the path /usr/openv/java/jre
.
Set the MATLAB_JAVA Environment Variable to this Path
The way you set or modify the value of the MATLAB_JAVA
variable depends on which platform you are running MATLAB on.
Windows NT/2000/XP. To set MATLAB_JAVA
on Windows NT, Windows 2000, or Windows XP,
MATLAB_JAVA
system environment variable to the path of your JVM.
For UNIX/Linux. To set MATLAB_JAVA
on UNIX or Linux systems,
Use the setenv
command, as shown here:
Using Java from MATLAB: An Overview | Bringing Java Classes and Methods into MATLAB |
© 1994-2005 The MathWorks, Inc.