Are JAR files built using MATLAB Compiler SDK platform independent?

2 views (last 30 days)
I would like to compile my M-function into a Java class using MATLAB Compiler SDK (MATLAB Builder JA in earlier releases) on one platform and distribute my Java archive in a platform independent manner.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 21 Jul 2020
Edited: MathWorks Support Team on 21 Jul 2020
In general Java classes built using MATLAB Compiler SDK are platform independent since MATLAB files are platform independent, as are JAR-files. There is a caveat when using C code shared libraries or MEX files which are not platform independent. In some instances, the MATLAB or Toolbox functions you are using in your application may depend on MEX files.
In this case, the easiest solution is to recompile the Java module with MATLAB Compiler SDK on each target platform.
It is also possible to avoid recompiling by moving the corresponding MEX files from each platform to your compile machine and include them in the build process using the –a flag to archive these files in the CTF.
Please see the documentation on “Ensuring Multi-Platform Portability”.

More Answers (0)

Categories

Find more on Troubleshooting in MATLAB Compiler SDK 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!