MATLAB Builder JA

Key Features

  • Royalty-free desktop and Web deployment of Java classes
  • MATLAB figure zooming, rotating, and panning via the WebFigures interface
  • Ability to port classes not containing MEX-files to all MATLAB supported platforms
  • API for automatic conversion between Java and MATLAB data types

The builder's Web Figures interface provides the zoom, pan, and rotate icons, letting the end user manipulate the image.

Java web application for visualizing a surface plot

Java Web application for visualizing a surface plot of the MATLAB peaks function.

Working with MATLAB Builder JA

Together, MATLAB, MATLAB Compiler, and MATLAB Builder JA enable you to develop applications using MATLAB, and then incorporate them in Java programs. You use MATLAB—a high-level, matrix-optimized language with built-in math, graphics, and data analysis functions—to rapidly prototype, implement, and test your algorithms. Once an application is complete, you use the builder to automatically package MATLAB code as Java classes. These classes can be integrated in a Java application and referenced in the same way as standard Java classes.

Like other Java components, the JAR files generated by the builder are generally platform-independent and run on any platform supported by MATLAB. For Hadoop clusters, MATLAB Builder JA creates deployable classes using mapreduce. Some toolbox functions are implemented as MEX-files, which are platform-dependent, making these functions and any Java components that use them not portable.

To create portable Java classes from MATLAB functions, MATLAB Builder JA encrypts the functions and generates a Java wrapper around them. To deploy these classes, you first install the MATLAB Compiler Runtime (MCR) on a target computer, and then run the classes incorporated in a Java program against the MCR. The MCR (provided with MATLAB Compiler) is the full set of shared libraries required for executing MATLAB based components. It provides complete support for all features of the MATLAB language and most toolboxes.

Using MATLAB Builder JA to convert the MATLAB file

Using MATLAB Builder JA to convert the MATLAB file plotfft.m into a Java component called SpectralAnalysis, with a class called Fourier.

Building and Packaging Components with the Deployment Tool

The combination of the MATLAB Compiler and MATLAB Builder JA enables you to build Java classes from MATLAB applications and then package them for deployment.

You can also:

  • Add MATLAB files and MEX-files to serve as externally visible class methods of your component
  • Automatically collect and package the files to deploy with the component
  • Add supporting files, including the MATLAB Compiler Runtime (MCR), to be packaged with your component in a self-extracting executable
  • Save compilation and packaging preferences
Financial Application

Financial application for calculating and visualizing Black-Scholes option value. The application uses MATLAB functions converted into a Java class by the builder to perform calculations and produce graphs.

Accessing Components

After instantiating a Java class from a MATLAB based component, you can access MATLAB functions as native Java methods. Native Java data types passed to MATLAB functions are automatically converted to MATLAB data types. Alternatively, you can explicitly select the data type to use.

Swing GUI with Java Native Interface (JNI )

A Java Swing application that calls MATLAB code for a loan amortization calculation using Java Native Interface (JNI).

Learn more about extending Java math capabilities with MATLAB.

Deploying MATLAB Based Java Components on a Desktop Computer

You integrate a MATLAB based Java class into an existing Java application by installing both the class and the MATLAB Compiler Runtime (MCR) on the target computer. The royalty-free MCR provides complete support for all features of the MATLAB language and most toolboxes. The Java application serves users working on the target computer. Using the builder's Remote Method Invocation (RMI) interface, you can also run your class as a persistent service or spread processing across multiple processes or computers.

Java Swing GUI communicating with MATLAB component

Mean-variance portfolio optimization and generation of an efficient frontier. Computed risk/return pairs and the associated stock weights are listed for each risk/return value. The application is written using the Java Swing libraries, and the underlying mathematics is performed by a Java component created by MATLAB Builder JA.

Learn more about extending Java math capabilities with MATLAB.

Deploying MATLAB Based Java Components on a Local Network or the Web

Deploying Java components on a local network or Web server enables multiple users to access an application in which the Java math component is integrated. You install the MATLAB Compiler Runtime (MCR) on the server only, and users can execute the application without installing MATLAB or the MCR on their individual computers. Users can interact dynamically with MATLAB figures through the builder's Web Figures interface for handling the 2D and 3D data visualization such as zooming, rotating, and panning.

You can also access MATLAB Web applications deployed as Java components with service-oriented architectures (SOAs), SOAP services, WDSL language, RMI interfaces, HTTP services, Java servlets, and JSPs.

Black Sholes example

Financial application for calculating and visualizing Black-Scholes option value implemented as a MATLAB web application. The application uses MATLAB functions converted into a Java class by MATLAB Builder JA to perform calculations and produce graphs.

Try MATLAB Builder JA

Get trial software

Teilen Sie Ihr Know-how – Anwendungsentwicklung mit MATLAB

View webinar