## ⚙️ 10. MATLAB Compiler (SDK) Deployment When compiling MATLAB™ code, in general, [MATLAB Compiler™](https://www.mathworks.com/products/compiler.html) will do a dependency analysis of the code and automatically include all the necessary files. However in the case of this package, because Java components are used [which need to be loaded on the Java class path](Installation.md#configuring-the-matlab-java-class-path), we have included additional steps in the `startup.m` scripts to automatically add the JAR-file to the MATLAB dynamic path in both deployed and local environment. In case you want to JAR-file to *static* path, you can do so. One of the option is to make it available in MATLAB Runtime as explained below. ### 🔸 JAR-file in MATLAB Runtime In some situation, for example when working with multiple MATLAB Compiler Java/.NET/Python modules in a single Java/.NET/Python application, this is simply something to "keep in mind" and it may be possible to ensure that the right component is loaded first. However, this can not always be *guaranteed*, especially in [MATLAB Production Server](https://www.mathworks.com/products/matlab-production-server.html) workflows, where it is not possible to predict which component will be called first inside which worker process. In such situations an option could be to add the JAR-file to the MATLAB Runtime such that it is *always* loaded, regardless of which exact component instantiated this runtime first. First, at compile time, again add the following two files to the "Files required for your application to run" (or using `mcc`'s `-a` flag): * `matlab-aws-support-v2/Software/MATLAB/lib/jar/log4j.properties` * `matlab-aws-support-v2/Software/MATLAB/lib/jar/log4j2.xml` Then, manually copy the following three files to the target machine onto which the component will be deployed: * `matlab-aws-support-v2/Software/MATLAB/lib/jar/matlab-aws-support-v2-0.1.0.jar` * `$MATLABROOT/java/jarext/slf4j/slf4j-api.jar` * `$MATLABROOT/java/jarext/slf4j/slf4j-log4j12.jar` The files can basically be placed anywhere on this machine as long as they are accessible by the runtime. Lastly, also on the target machine where the MATLAB Runtime has been installed, open `$MCRROOT/toolbox/local/classpath.txt` (where `$MCRROOT` stands for the installation directory of the MATLAB Runtime) in a text editor and add the full absolute locations of the three files to the *front* of the list of JAR-files and directories in the text file. ````{note} The `toolbox/local/classpath.txt` file contains a notification: ``` #DO NOT MODIFY THIS FILE. IT IS AN AUTOGENERATED FILE. ``` For this particular use-case, this can partly be ignored, the file *may* be edited but do indeed keep in mind that it may be changed or overwritten when reinstalling the MATLAB Runtime or installing an Update to the runtime. The modification may have to be reapplied afterwards. ```` ```{hint} Contact us at [mwlab@mathworks.com](mailto:mwlab@mathworks.com) if you require additional advice on your specific use-case of deploying MATLAB Code which makes use of the "MATLAB Interface *for Amazon Web Services*". ``` [//]: # (Copyright 2025 The MathWorks, Inc.)