CallJavafromMATLAB
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.class
files, 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
开始
- 开始with Java Libraries
Requirements for using the MATLAB Java interface. - Java Class Path
Bring Java classes into the MATLAB workspace.
UsingJavaLibraries
- Call Java Method
How to call a method in the Java standard library class
晶澳va.util.ArrayList
. - Call Method in Your Own Java Class
Use the dynamic class path to develop your own Java classes. - Call Back into MATLAB from Java
How to write Java programs that call into MATLAB from a running MATLAB. - Simplify Java Class Names Using import Function
Use theimport
function to refer to a class by its class name only. - Java Packages to Be Removed
Add Java packages to MATLAB static path.
JavaArrays
- MATLAB是Java数组如何
How MATLAB interprets the size, shape, and dimension of a Java array.
JavaObjects
Java方法
- Method Information
Getting information about methods.
Troubleshooting
How to adjust the Java heap size.
Avoid Calling Java main Methods in MATLAB
How MATLAB handlesmain
methods.