MATLAB Answers

Compiler SDK: Testing *.jar file + runtime as if on a virgin machine

1 view (last 30 days)
FM
FM on 25 Jun 2021
Edited: FM on 5 Jul 2021
Hello,
I wrote a function in MyFunction.m that that performs minor processing on its inputs before invoking "intlinprog". I used Compiler SDK to convert the MyFunction.m file into MyFunction.jar file. The Java developer who will use this is outside of my organization, and I have limited contact with him. I need to ensure that the MyFunction.jar file is as reliably usable as possible.
In the compilation process, I chose to have the end user download and install the runtime instead of packaging it with my function. I tested the installation process on a local machine, and it installs the following file:
C:\Program Files\MATLAB\R2019a\toolbox\javabuilder\jar\javabuilder.jar
If CallMyFunction.java contains the Java code that invokes my function, then following two (Cygwin) bash commands compile and execute it:
javac -cp \
"MyFunction.jar;C:\Program Files\MATLAB\R2019a\toolbox\javabuilder\jar\javabuilder.jar" \
CallMyFunction.java
java -cp \
"MyFunction.jar;C:\Program Files\MATLAB\R2019a\toolbox\javabuilder\jar\javabuilder.jar;." \
CallMyFunction
I have been asked to put all required files into a common folder, so I will be experimenting with moving javabuilder.jar. However, it is difficult to get a "virgin" machine (i) without Matlab installed either now or in the past, and (ii) without the runtime installed either now or in the past. I am concerned that if I conduct a trial on a machine with a history of either of these two, remnants in the file system or registry may permit success when a failure would have occurred on a virgin machine.
As an example of why I am concerned, I know from past communication with TMW that the runtime is sophisticated enough to check for things like a Matlab installation. If it finds Matlab, it will use Matlab for function calls instead of the runtime. What if the runtime also checks for files in the file system, and path info (or other info) in the registry, which may have been left behind from previous use of a runtime? If so, then any test that I perform will not reflect what the remote Java developer will encounter.
Would anyone be able to shed light on the following questions?
(1a) Is it enough to simply have javabuilder.jar and not undergo a runtime installation process?
(1b) Apart from javabuilder.jar, what else is installed that I need to ensure is in place for MyFunction.jar to be usable?
(2a) How thorough is the procedure for uninstalling the runtime [1,2]? Would it leave behind files or registry information that can yield apparent success when experimenting with different ways to make javabuilder.jar available, but not actually undergoing the runtime installation procedure?
(2b) Does uninstalling the runtime mean that I will see exactly the same behaviour as someone who has never installed the runtime? I need this to ensure head off as many possible hiccups as possible that may be encountered by the Java developer.
(3) Would I be correct in assuming that if a machine has Matlab installed, there's no point trying to make MyFunction.jar work with the runtime because there would be too many uncertainties?
Thank you!
Fred
References cited above:
[1] https://www.mathworks.com/help/compiler_sdk/java/install-the-matlab-runtime.html#bvf6cbg
[2] https://www.mathworks.com/help/pdf_doc/compiler_sdk/compiler_sdk_java.pdf

Accepted Answer

FM
FM on 5 Jul 2021
Edited: FM on 5 Jul 2021
According to TMW, there's not much to be gained by collecting key files needed to use the MATLAB Runtime into a project folder. In order to function properly, those files need the rest of the infrastructure that is built during installation of the Runtime, and should be considered a site/machine-wide resource. Additionally, copying the files into a project/user-specific folder is not a usage that is supported by TMW. This renders the question moot.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by