Main Content

CallJavafromMATLAB

Directly call Java®library functionality from MATLAB®

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

You can run MATLAB with your system version of the Java Runtime Environment (JRE™). For information about Java versions compatible with MATLAB, seeMATLAB Interfaces to Other Languages. To set the JRE path in MATLAB, calljenv. To set the path from the operating system prompt, callmatlab_jenv.

If instead you want to call MATLAB functions from Java applications, seeCall MATLAB from Java.

Functions

isjava Determine if input isJavaobject
晶澳vaaddpath Add entries to dynamicJavaclass path
晶澳vaArray ConstructJavaarray object
晶澳vachk Error message based onJavafeature support
晶澳vaclasspath ReturnJavaclass path or specify dynamic path
晶澳vaMethod CallJavamethod
晶澳vaMethodEDT CallJavamethod from Event Dispatch Thread (EDT)
晶澳vaObject CallJavaconstructor
晶澳vaObjectEDT CallJavaconstructor on Event Dispatch Thread (EDT)
晶澳varmpath Remove entries from dynamicJavaclass path
usejava Determine ifJavafeature is available
jenv SetJREJava Runtime Environment path forMATLAB
matlab_jenv SetJREJava Runtime Environment path forMATLABfrom system prompt

Classes

matlab.exception.JavaException Capture error information forJava异常

Topics

开始

UsingJavaLibraries

Troubleshooting

Java Heap Memory Preferences

How to adjust the Java heap size.

Avoid Calling Java main Methods in MATLAB

How MATLAB handlesmainmethods.