Why do I get a permission denied error in regards to classpath.txt or pathdef.m when starting MATLAB?
425 views (last 30 days)
MathWorks Support Team on 1 Oct 2013
MATLAB does not start properly or run after being started. The command window displayed this error:
C:\Program Files\MATLAB\R2012b\toolbox\local\classpath.txt: Cannot open file: permission denied.
ERROR: C:\Program Files\MATLAB\R2012b\toolbox\local\pathdef.m: Cannot open file: permission denied.
How can I fix this error?
MathWorks Support Team on 2 May 2016
This error indicates that the user account you are executing MATLAB under does not have read access to the classpath.txt or pathdef.m file, which is required to run MATLAB.
To resolve this issue, change permissions on the entire MATLAB installation folder to include read permissions for all users. If you are unable to change permissions on your machine, contact your system administrator.
More Answers (6)
Jan on 7 Jun 2017
Better change the permissions for the pathdef.m and classpath.txt files only, or at least only <matlabroot>\toolbox\local. This has a drawback on a multi-user machine: Then all users can adjust pathdef.m to you needs and the next user might be confused.
Prefer user-defined pathdef.m files inside a folder belonging to the user path. This is save and allows individual changes.
I'm using a different strategy: I've edited the <matlabroot>\toolbox\local\pathdef.m to add the folder "D:\MFiles\Inits". This fiolder contains user defined functions to add the personal set of folders to the path dynamically. This allows multiple users to work on one machine and different projects or versions also without the danger of interferences.
埃博拉酱 on 27 Nov 2021
This is a very ugly design!
All path settings should be user-wide instead of system-wide by default! MATLAB default pathdefs should stay in Installation folder still, but each user should have his own self-added pathdef in the user directory like %APPDATA%\MathWorks\MATLAB\R2021b! Then each user can edit his own pathdef as he like, without any side effect on other users!
Adeel Ashraf on 7 Jun 2017
very simple just create new folder on desktop etc and copy it path and paste on command window after write cd like this cd 'paste path here' or cd 'C:\Users\Adeel011\Desktop\matlabexample'