| Contents | Index |
| On this page… |
|---|
Your Role in the Java Application Deployment Process |
Depending on the size of your organization, you may play one role, or many, in the process of successfully deploying a Java application.
For example, your job may be to analyze user requirements and satisfy them by writing a program in MATLAB code. Or, your role may be to implement the infrastructure needed to successfully deploy a Java application to the Web. In smaller installations, you may find one person responsible for performing tasks associated with multiple roles.
The table Application Deployment Roles, Tasks, and References describes some of the different roles, or jobs, that MATLAB Builder JA users typically perform and which tasks they would most likely perform when running The Magic Square Example.
Application Deployment Roles, Tasks, and References
| Role | Tasks | References |
|---|---|---|
| MATLAB programmer |
| Testing the MATLAB File You Want to Deploy Creating the Magic Square Java Component |
| Java developer |
| Gathering Files Needed for Deployment Testing the Java Component in a Java Application Distribute MATLAB Code Using the MATLAB Compiler Runtime (MCR) Calling Class Methods from Java |
| End user | Execute the solution created by MATLAB and Java developers. | Run the deployed application (outside the scope of this document). |
The following knowledge is assumed when you use the MATLAB Builder JA product:
If your job function is MATLAB programmer, the following is required:
A basic knowledge of MATLAB, and how to work with cell arrays and structures
If your job function is Java developer, the following is required:
Exposure to the Java programming language
Object-oriented programming concepts
You must install the following products to run the example described in this chapter:
MATLAB
MATLAB Compiler
MATLAB Builder JA
Before you deploy your code, examine the code for dependencies on functions that may not be compatible with MATLAB Compiler.
For more detailed information about dependency analysis (depfun) and how MATLAB Compiler evaluates MATLAB code prior to compilation, see MATLAB Code Deployment in the MATLAB Compiler User's Guide.
Systems Administrator
Configure your environment to work with the examples. Consult your system administrator or Java developer before performing these tasks—some may be unnecessary. Your administrator or programmer is often the best resource for verifying, installing, or customizing your Java environment.
Note For updated Java system requirements, including versions of Java Developer's Kit (JDK) and Java Runtime Environment (JRE), see the supported compiler page at http://www.mathworks.com/support/compilers/current_release/. |
You may already be running a compatible version of Java. To find out if you have Java installed on your computer, and if it is compatible with the MATLAB Builder JA product:
Open a command prompt.
Enter the command java -version. If Java is installed, the result looks like this:
java version "version_number"
Java(TM) 2 Runtime Environment, Standard Edition
(build version_number.build_number
Java HotSpot(TM) Client VM
(build version_number.build_number, mixed mode)Enter the command javac -version.
Note Alternately, you may have to enter %JAVA_HOME%\bin\javac -version if you have the user environment variable JAVA_HOME defined. For information on locating environment variables, see Setting Up Your Java Environment. |
If javac is installed, the results should look like this:
javac version_number
If java and javac are installed, go to The Magic Square Example. If not, go to Setting Up Your Java Environment.
Note You should be using the same version of Java that ships with MATLAB. To find out what version of Java MATLAB is running, enter the following MATLAB command: version -java |
Download and install the Java Developer's Kit (JDK) from Sun Microsystems™, Inc. if you do not yet have it installed.
The JDK is a collection of Java classes, run-time environment, compiler, debugger, and usually source code, for a version of Java. The contents of the JDK collectively make up a Java development environment.
The JDK includes the Java Runtime Environment (JRE), a collection of compiled classes that makes up the Java virtual machine, a standalone executor of the Java language, on a specific platform.
Set the environment variable JAVA_HOME. This tells Java where to find your installed JDK. from the MATLAB prompt. You can set JAVA_HOME:
On Windows platforms:
Right-click the My Computer icon and select Properties.
Click the Advanced tab.
Click Environment Variables.
In the User Variables area, click New.
In the New User Variable dialog box, enter JAVA_HOME for Variable name. Enter the absolute path name where your JDK is installed for Variable value. Here is the value of a typical JAVA_HOME environment variable:
C:\Program Files\Java\JDK1.6.0_03
Click OK to accept changes.
On UNIX platforms:
Open a command prompt.
Set JAVA_HOME as follows:
set JAVA_HOME=JDK_pathname
Note When using the Bash or C (csh) shells, the command is somewhat different. The Bash shell uses export in place of set. csh uses setenv. |
to set the variable. Although this may work in a specific shell; this won't do the trick in the commonly used bash (need to use "export") or csh (need to use "setenv") (based) shells. So we may want to change the instructions.
Verify that MATLAB is reading the correct value of JAVA_HOME.
At the command prompt, type getenv JAVA_HOME.
The response from MATLAB should be the path name you set to JAVA_HOME in Configuring Your Environment. If not, ensure the JDK that MATLAB is pointing to will be compatible to run this example. Consult your system administrator if you are unsure.
![]() | Product Overview | Quick Start: Deploying a Component with the Hello World Example | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |