External Interfaces |
Bringing Java Classes and Methods into MATLAB
You can draw from an extensive collection of existing Java classes or create your own class definitions to use with MATLAB. This section explains how to go about finding the class definitions that you need or how to create classes of your own design. Once you have the classes you need, defined in either individual .class
files, packages, or Java Archive files, you will see how to make them available within the MATLAB environment. This section also covers how to specify the native method libraries used by Java.
This section addresses the following topics:
Sources of Java Classes
There are three main sources of Java classes that you can use in MATLAB:
The Java language includes general-purpose class packages, such as java.awt
. See your Java language documentation for descriptions of these packages.
You can define new Java classes or subclasses of existing classes. You need to use a Java development environment to do this, as explained in the following section.
Defining New Java Classes
To define new Java classes and subclasses of existing classes, you must use a Java development environment, external to MATLAB, that supports Java version 1.4.2. You can download the development kit from the web site at Sun Microsystems, (http://java.sun.com/j2se/). The Sun site also provides documentation for the Java language and classes that you will need for development.
After you create class definitions in .java
files, use your Java compiler to produce .class
files from them. The next step is to make the class definitions in those .class
files available for you to use in MATLAB.
Using a Different Version of the Java JVM | The Java Class Path |
© 1994-2005 The MathWorks, Inc.