Aufrufen von Java aus MATLAB heraus
Sie können auf vorhandene Java-Klassen zugreifen, die im MATLAB-Workspace eingesetzt werden können. Verwenden Sie beispielsweise integrierte Klassenpakete wie java.util, die zum Lieferumfang der Java-Sprache gehören. Beschreibungen dieser Pakete finden Sie in der Dokumentation zur Java-Sprache. Sie können auch auf Klassen zugreifen, die in einzelnen .class-Dateien, Paketen oder Java Archivdateien (JAR) definiert sind (einschließlich der von Ihnen entwickelten Klassen).
Sie können MATLAB mit Ihrer Systemversion von Java Runtime Environment (JRE™) ausführen. Versionsinformationen finden Sie unter Versions of OpenJDK Compatible with MATLAB by Release. Rufen Sie zur Festlegung des JRE-Pfads in MATLAB die Funktion jenv auf. Rufen Sie zur Festlegung des Pfads von der Eingabeaufforderung des Betriebssystems aus die Funktion matlab_jenv auf.
Wie Sie stattdessen MATLAB-Funktionen aus Java-Anwendungen heraus aufrufen, erfahren Sie unter Aufrufen von MATLAB aus Java heraus.
Funktionen
isjava | Determine if input is Java object |
javaaddpath | Add entries to dynamic Java class path |
javaArray | Construct Java array object |
javachk | Error message based on Java feature support |
javaclasspath | Return Java class path or specify dynamic path |
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) |
javarmpath | Remove entries from dynamic Java class path |
usejava | Determine if Java feature is available |
jenv | Set Java path for MATLAB (Seit R2021b) |
matlab_jenv | Set the Java path for MATLAB from system prompt (Seit R2021b) |
Objekte
JavaEnvironment | Java environment information (Seit R2023a) |
Klassen
matlab.exception.JavaException | Capture error information for Java exception |
Themen
Erste Schritte
- Get Started with Java Libraries
Requirements for using the MATLAB Java interface. - Konfigurieren Ihres Systems zum Verwenden von Java
So können Sie überprüfen, ob Sie eine unterstützte Version von Java installiert haben - Java Class Path
Bring Java classes into the MATLAB workspace.
Nutzung von Java-Bibliotheken
- Call Java Method
How to call a method in the Java standard library class
java.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 theimportfunction to refer to a class by its class name only. - Support Forward Compatibility of Java
Add Java packages to MATLAB static path.
Java-Arrays
- How MATLAB Represents Java Arrays
How MATLAB interprets the size, shape, and dimension of a Java array.
Java-Objekte
Java-Methoden
- Method Information
Getting information about methods.
Fehlersuche
Java Runtime Environment Settings
How to set the JRE path or adjust the Java heap size.
Avoid Calling Java main Methods in MATLAB
How MATLAB handles main methods.