Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

Call Java Libraries

Access Java® libraries from MATLAB®

You can access existing Java classes or create your own to use in the MATLAB workspace. For example, use built-in class packages, such as java.util, which are included in the Java language. See your Java language documentation for descriptions of these packages. You can also access classes defined in individual .class files, packages, or Java Archive (JAR) files.

Functions

javaArray Construct Java array object
import Add package or class to current import list
javaclasspath Return Java class path or specify dynamic path
javaaddpath Add entries to dynamic Java class path
javarmpath Remove entries from dynamic Java class path
javachk Error message based on Java feature support
isjava Determine if input is Java object
usejava Determine if Java feature is available
javaMethod Call Java method
javaMethodEDT Call Java method from Event Dispatch Thread (EDT)
javaObject Call Java constructor
javaObjectEDT Call Java constructor on Event Dispatch Thread (EDT)

Classes

matlab.exception.JavaException Capture error information for Java exception

Examples and How To

Call Method on Java Object

How to call a Java object method in MATLAB.

Convert Java String to Uppercase

This example shows how to call a built-in Java String class method, toUpperCase.

Use Class in Java JAR File on Static Class Path

This example shows how to call a class method in a Java Archive (JAR) file.

Call User-Defined Java Class on Dynamic Class Path

This example shows how to call a method in your own Java class.

Read URL Using java.net.URL

This example opens a connection to a website specified by a URL to read text from a file at that site.

Find Internet Protocol Address Using java.net.InetAddress

This example returns the name or address of an IP host.

Create and Use Phone Book Using Java Classes

This example uses Java classesjava.io.FileOutputStream, java.io.FileInputStream, and java.util.Hashtable to create and modify a list of names and numbers.

Concepts

Java Libraries

How you can benefit from using the MATLAB Java interface.

Bring Java Classes into MATLAB Workspace

How to use Java built-in, third party, or your own classes in MATLAB.

Java Objects

Construct and work with Java objects.

Java Object Methods

Calling syntax, static methods, and getting information about methods.

Java Arrays

How MATLAB represents Java arrays and how to work with them.

Pass Data to Java Methods

How to pass MATLAB types to Java methods.

Handle Data Returned from Java Methods

How to handle types returned by Java methods.

Troubleshooting

Java Heap Memory Preferences

How to adjust the Java heap size.

Was this topic helpful?