Using the MATLAB library compiler for Java: compilation error

1 view (last 30 days)
Hello,
I have some MATLAB code that I want to package into a jar file so I may use it in a non-MATLAB machine. I tried making a jar file for a very simple file:
function [ num ] = squareRoot(n)
%%testing testing
num = sqrt(n);
end
Using Library compiler (Java package option), I named the library sr, main class also sr with the method [num] = squareRoot(n). The runtime included in package option was selected.
For this simple case, I get an error while compilation. Attached is the packing log.
Any help would be great! Is there something I am doing wrong? Any suggestions/comments would be helpful!
MATLAB version I am using is R2015a. Java version is 1.7.

Answers (1)

Arnab Sen
Arnab Sen on 24 Feb 2016
Hi Kriti,
From the log it seems that the issue might be related to java configuration in your machine.
Refer to the following links and make sure all the configuration is proper before launching MATLAB:
Also check the compatible compilers from following link:
If the issue still persists, use "mcc" command with the -K flag. This will allow MATLAB to keep the intermediate files without deleting them while compiling. Also this creates a working Java package even if the build fails with "javadoc" error.
It is possible that you may be using deploytool for building the JAR file. If you are using deploytool, please use the "-K" flag under Settings-> Additional parameters to MCC.
Please refer to the link below for mcc options:

Categories

Find more on Java Package Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!