Undocumented startup option / Starting MATLAB GUI from Java

3 vues (au cours des 30 derniers jours)
Ivan Kokan
Ivan Kokan le 16 Fév 2022
Commenté : Jan le 23 Fév 2022
Hi, we are using MATLAB R2018b on Windows 10 Enterprise and trying to automate the MATLAB execution from Java.
Firstly, consider the following scenarios starting MATLAB from the Windows Command Prompt:
i) matlab
It expectedly shows the splash screen, opens the MATLAB GUI with the clear Command Window and Workspace.
ii) matlab -nojvm
It expectedly shows the splash screen, does not open the MATLAB GUI but the plain and clear MATLAB Command Window instead.
iii) matlab -jvvm
It expectedly shows the splash screen, opens the MATLAB GUI with the following warning in Command Window and clear Workspace:
Warning: Unrecognized command line option: jvvm.
iv) matlab -jvm
It shows the splash screen, opens the MATLAB GUI with the clear Command Window and Workspace, i.e. no warning about Unrecognized command line option is raised.
It seems that the naive try with option -jvm succeeded although such option is not documented at all (we checked the documentation for many different MATLAB releases, hopefully have not missed anything in this context).
Nevertheless, it is surprising that the option -nojvm is declared to be used only for "Mac and Linux® platforms" (https://www.mathworks.com/help/releases/R2018b/matlab/matlab_env/commonly-used-startup-options.html), and this is a common thing, not only for R2018b.
So, here are some questions:
1. Why the option -nojvm is not declared to be used for "Windows® platforms" as well, i.e. for "All"?
2. It seems that the option -jvm really exists and it is not documented anywhere, not even in "for some -no* options, there are opposites that can be used to achieve the opposite effect"? Why isn't that documented, and will it be?
The motivation behind the previous scenarios was that starting the MATLAB engine from Java (explained here for example: https://www.mathworks.com/help/releases/R2018b/matlab/matlab_external/start-matlab-session-from-java.html ) does not open the MATLAB GUI, which we explicitly want. So we tried to test various startup options and naively got into the "non-existing" -jvm option. That one definitely helped to raise the MATLAB GUI from Java but we wanted to get the confirmation that we can reliably use that option.
Regards, Ivan
  3 commentaires
Ivan Kokan
Ivan Kokan le 22 Fév 2022
No difference when calling such from the Windows Command Prompt. But there is a difference when starting MATLAB from Java, as explained at the end of my original post.
Jan
Jan le 23 Fév 2022
In this example you do not start Matlab, but the Matlab-Engine. This is a difference. If you want to start Matlab with a GUI, using this would be less indirect:
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(command);
process.waitFor();

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 16 Fév 2022
As far as I remember, starting Matlab with the Java VM was optional in Matlab 4 or 5. So you could enable the JVM manually. Therefore the -jvm flag might be kept for backward compatibility.
I do not see, why -nojvm concerns Macs and Linux only.
  2 commentaires
Ivan Kokan
Ivan Kokan le 22 Fév 2022
Thanks for the feedback. I still wait for some official explanation and guidance.
Bruno Luong
Bruno Luong le 22 Fév 2022
Usualy TMW don't comment on things that are not documented and make any comment on "features" that go beyong the official documentation.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by