Product Overview

Sun Java Interface Is Integral to MATLAB Software

Every installation of MATLAB software includes Java Virtual Machine (JVM) software, so that you can use the Java interpreter via MATLAB commands, and you can create and run programs that create and access Java objects. For information on the MATLAB installation, see the MATLAB installation documentation for your platform.

Benefits of the MATLAB Java Interface

The MATLAB Java interface enables you to:

Who Should Use the MATLAB Java Interface

The MATLAB Java interface is intended for all MATLAB users who want to take advantage of the special capabilities of the Java programming language.

For example:

To Learn More About Java Programming Language

For a complete description of the Java language and for guidance in object-oriented software design and programming, you'll need to consult outside resources. For example, these recently published books may be helpful:

Another place to find information is the JavaSoft Web site.

http://www.javasoft.com

For other suggestions on object-oriented programming resources, see:

Platform Support for JVM Software

To find out which version of JVM software is used by MATLAB on your platform, type the following at the MATLAB prompt:

version -java

Using a Different Version of JVM Software

MATLAB ships with one specific version of JVM software and uses this version by default with the MATLAB interface to the Java language. This section describes how to download and select a version other than the default.

To change the JVM software version that MATLAB uses, follow these steps:

  1. Download the JVM Software Version You Want to Use.

  2. Locate the Root of the Run-time Path for this Version.

  3. Set the MATLAB_JAVA Environment Variable to this Path.

To verify that MATLAB is using the correct version of the JVM software, type the version -java command.

Download the JVM Software Version You Want to Use

You can download JVM software from the Web site http://www.java.com/en/download/manual.jsp.

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 software version, 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 Sun JDK™ install directory. (If you cannot find rt.jar, look for the file classes.zip.)

For example, if the JDK software is installed in D:\jdk1.2.1 on a Microsoft Windows system and the rt.jar file is in D:\jdk1.2.1\jre\lib, set MATLAB_JAVA to the directory one level up from that: D:\jdk1.2.1\jre.

On a UNIX[1] system, if the JDE software 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 XP Operating System.  

  1. Click Settings in the Start Menu.

  2. Choose Control Panel.

  3. Click System.

  4. Choose the Advanced tab, and then click the Environment Variables button.

  5. You now can set (or add) the MATLAB_JAVA system environment variable to the path of your JVM software.

UNIX or Linux[2] Operating Systems.  

setenv MATLAB_JAVA <path to JVM>

[1] UNIX is a registered trademark of The Open Group in the United States and other countries.

[2] Linux is a registered trademark of Linus Torvalds.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS