Why do I receive "Fatal Error on startup: Java exception occurred: java.lang.​NoClassDef​FoundError​: Could not initialize class com.mathwo​rks.servic​es.binding​.MatlabKey​Bindings" when starting MATLAB on Linux or macOS?

57 visualizaciones (últimos 30 días)
Why do I receive "Fatal Error on startup: Java exception occurred:  java.lang.NoClassDefFoundError: Could not initialize class com.mathworks.services.binding.MatlabKeyBindings" when starting MATLAB on Linux or macOS?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 23 de Mzo. de 2021
Editada: MathWorks Support Team el 8 de Mayo de 2023
This error indicates that MATLAB is not able to locate or read your MATLAB preferences directory. This could be due to a setting or variable on your system which is causing MATLAB to look for your preferences in a location where you do not have read access.
Typically this happens due to running a configuration script for MATLAB such as ‘config_matlab.sh’ which attempts to set your preferences directory to a non-default location where you do not have read or write access. You should start by removing the portion of the script which sets your environment variable.
This can also be resolved by creating an environment variable to specify your MATLAB preferences directory immediately before starting MATLAB. You should choose a directory where you have both read and write access. The default location is in your home folder. As an example of the command to run before starting MATLAB, see the following:
Linux
export MATLAB_PREFDIR=~/.matlab/R2023a
/usr/local/MATLAB/R2023a/bin/matlab
Mac
export MATLAB_PREFDIR=~/.matlab/R2023a
/Applications/MATLAB_R2023a.app/bin/matlab
This command sets your MATLAB preferences directory to be the default directory inside your home folder. Then, on the next line, the command is to launch MATLAB.
  1 comentario
Walter Roberson
Walter Roberson el 15 de Dic. de 2017
The above bit about environment variables is for OS-X/MacOS and for Linux, and assumes that the user is using a shell derived from ksh . However, ksh and derivatives are case sensitive, and the command in them is export rather than Export . Also the second line needs to begin with /
export MATLAB_PREFDIR=~/.matlab/R2015a
/usr/local/MATLAB/R2015a/bin/matlab
/usr/local/MATLAB is used for Linux but in OS-X /MacOS the equivalent would be
/Applications/MATLAB_R2015a.app/bin/matlab

Iniciar sesión para comentar.

Más respuestas (1)

David
David el 31 de Ag. de 2015
I want to report another common reason matlab on linux would be unable to read the preferences file. I often run matlab over a VPN I establish to the head node of a computer cluster. I then use matlab to submit parallel jobs to the compute nodes. Sometimes, I'll have more than one VPN tunnel established at once- one from a work computer, then later another from my laptop, or maybe from a different work computer. None of my tunnels can see the other's applications, so I end up running multiple copies of matlab operating out of my same user folder.
If one matlab opens the preference file for writing, perhaps because I made a change to the window arrangement, then when I attempt to open the second matlab through a different terminal, I receive this error.
If this applies to anyone else, the solution is that if you change the preferences in one instance of matlab, reboot this one before trying to open other instances. If you already have multiple instances running when you change the preferences from one instance, the others will stay open, but will throw this error when you try to reboot them.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by