Why does MATLAB throw Java or preferences errors on startup?

7 次查看(过去 30 天)
When starting MATLAB on Windows I receive one of the following errors:
ERROR: Initializing Java preferences failed in matlabrc
Error starting Desktop
com.mathworks.com.mwswing.desk...
...
...
java.awt.event

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2023-4-19
This problem occurs when the MATLAB preferences have been corrupted. To resolve this issue, you can remove the preferences so that they are regenerated. To do so, make sure you have enabled viewing of hidden files and folders, and then follow the steps below:
1. Find the location of the MATLAB Preference directory using the PREFDIR command. Type the following at the MATLAB command prompt:
prefdir
In MATLAB 7.0 (R14), the output should look like
C:\WINNT\Profiles\{username}\Application Data\MathWorks\MATLAB\R14 (on Windows)
/home/{username}/.matlab/R14 (on UNIX)
/Users/{username}/.matlab/R14 (on Mac)
This is where your "matlab.prf" file is located. This path may be different depending on how your system is setup. The preference directory may be hidden in some operating systems.
2. Make sure that all MATLAB sessions are closed and rename the preferences directory of your current MATLAB version and all older versions of MATLAB to something else. For example, in MATLAB 7.0 (R14), rename the directory R14 to R14old. If you also have MATLAB 6.5 (R13) installed on your computer, rename the R13 directory to R13old.
NOTE: Do not remove any folder that ends with "_licenses."
3. Restart MATLAB. A new preferences directory will be created for the MATLAB version that is launched.
If this does not address the issue that you hoped it would, it is possible to restore your preferences by deleting the newly created directories (R14 and/or R13) and renaming the R14old and/or R13old directories to their original names (R14 and R13 respectively).
If MATLAB does not throw the error, but still will not start, see the related solution: "Why will MATLAB not start up properly on my Windows based system?"
If you are still unable to start MATLAB, contact the Installation and Licensing team here:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

尚未输入任何标签。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by