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?

조회 수: 38 (최근 30일)
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?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 3월 23일
편집: MathWorks Support Team 2023년 5월 8일
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
Walter Roberson
Walter Roberson 2017년 12월 15일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

David
David 2015년 8월 31일
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.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by