Java Package Integration
With MATLAB Compiler SDK™, integrating compiled MATLAB functions into a Java application involves using a combination of APIs that initialize MATLAB Runtime, load the compiled MATLAB functions into MATLAB Runtime, and manage the data that passes between Java and MATLAB.
Java packages and applications provide portable and scalable solutions for applications in large-scale enterprise or web environments. You can deploy generated packages to enterprise or web environments where MATLAB Runtime is installed.
Java Remote Method Invocation (RMI) is a set of APIs that enable Java objects to invoke objects in a different Java virtual machine (JVM). Use RMI to develop client-server applications, distributed applications, and web applications. For such applications, only the portions of the application that directly invoke MATLAB functions require MATLAB Runtime. The other portions of the application can work with native Java data types.
|Create Java package for deployment outside MATLAB (Since R2021a)
|Options for building Java packages (Since R2021a)
|Display version and location information for MATLAB Runtime installer corresponding to current platform
|Return MATLAB Runtime version number that matches MATLAB version
Requirements and Highlights
- Requirements and Limitations of MATLAB Compiler SDK Java Target
Refer to the software requirements for using MATLAB Compiler SDK to create Java packages.
- Configure Your Environment for Generating Java Packages
Configure the Java environment to compile MATLAB code into Java packages using MATLAB Compiler SDK.
- How MATLAB Compiler SDK Java Integration Works
Learn how the MATLAB Compiler SDK Java handles data.
- Programming Interfaces Generated by MATLAB Compiler SDK
Learn about the function signatures created to handle MATLAB methods.
Create and Integrate with Java
- Generate Java Package and Build Java Application
Create a Java package in MATLAB and implement it with sample Java code.
- Create Sample Code to Call Exported Function
Generate sample code in C++, .NET, Java, or Python® by including sample files during packaging.
- Integrate Simple MATLAB Function into Java Application
Learn how to integrate a MATLAB generated Java package into a Java application.
- Display MATLAB Plot in Java Application
Build a Java application that displays a MATLAB plot.
- Create Java Phone Book Application Using Structure Array
Encapsulate a MATLAB function that modifies a structure array containing phone numbers.
- Create Java Application with Multiple MATLAB Functions
Implement a signal analyzer application that incorporates multiple functions using dependency analysis.
- Assign Multiple MATLAB Functions to Java Class
Create a Java package containing multiple functions to implement a matrix math program.
- Use MATLAB Class in Java Application
Use object-oriented design to deploy a MATLAB class in a Java package.
- Pass Java Objects to MATLAB
Build a Java package that applies optimization routines to objective functions using the
- Block Console Display When Creating Figures in Java
waitForFiguresin a console-based Java application that generates MATLAB figures.
- Convert Data Between Java and MATLAB
See guidelines on how to convert data between Java and MATLAB.
- Rules for Data Conversion Between Java and MATLAB
Refer to the rules for converting Java types to MATLAB types.
- Manage MATLAB Resources in JVM
Properly create and dispose of MATLAB data in your code.
- Render MATLAB Image Data in Java
See techniques to work effectively with figure and image data in your code.
- Specify Parallel Computing Toolbox Profile in Java Application
Specify profile information for Parallel Computing Toolbox™ applications.
- Define Embedding and Extraction Options for Deployable Java Archive
Manage deployable archive embedding and extraction behavior using either the MWComponentOptions class or environment variables.
- Ensure Multiplatform Portability for Java
Ensure platform independence in your compiled MATLAB code.
- Limitations on Multiple Packages in Single Java Application
Learn the data types that cannot be shared across Java packages.
- Map Functions to Java Classes
Map MATLAB functions to Java class methods during compilation.
Remote Method Invocation
- Remote Method Invocation for Client-Server Applications
Learn how RMI allows you to run separate processes on multiple machines.
- Run Client and Server Using RMI
Try an example using RMI with a client and server.
- Represent Native Java Cell and Struct Arrays
See an example illustrating the use of native Java cell and struct arrays.
Troubleshooting Java Packages
- Common Failure Messages
Common error messages during Java package integration and possible workarounds.