Call Java from MATLAB
You can access existing Java classes 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 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, see MATLAB Interfaces to Other Languages. To set the JRE path in MATLAB, call
To set the path from the operating system prompt, call
If instead you want to call MATLAB functions from Java applications, see Call MATLAB from Java.
|Determine if input is Java object|
|Add entries to dynamic Java class path|
|Construct Java array object|
|Error message based on Java feature support|
|Return Java class path or specify dynamic path|
|Call Java method|
|Call Java method from Event Dispatch Thread (EDT)|
|Call Java constructor|
|Call Java constructor on Event Dispatch Thread (EDT)|
|Remove entries from dynamic Java class path|
|Determine if Java feature is available|
|Set Java path for MATLAB (Since R2021b)|
|Set the Java path for MATLAB from system prompt (Since R2021b)|
|Java environment information (Since R2023a)|
|Capture error information for Java exception|
- Get Started with Java Libraries
Requirements for using the MATLAB Java interface.
- Configure Your System to Use Java
How to verify you have installed a supported version of Java.
- Java Class Path
Bring Java classes into the MATLAB workspace.
Using Java Libraries
- Call Java Method
How to call a method in the Java standard library class
- 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
importfunction to refer to a class by its class name only.
- Java Packages to Be Removed
Add Java packages to MATLAB static path.
- Method Information
Getting information about methods.