MATLAB Answers

How can i solve this problem?

3 views (last 30 days)
Alex Fogli
Alex Fogli on 9 Jul 2021
Answered: Kiran Felix Robert on 12 Jul 2021
Exception in thread "Startup Class Loader": java.lang.NoClassDefFoundError: Could not initialize class com.mathworks.instutil.InstutilResourceKeys
at com.mathworks.mlwidgets.help.DocCenterRoot.initDocRelease(DocCenterRoot.java:44)
at com.mathworks.mlwidgets.help.DocCenterRoot.<clinit>(DocCenterRoot.java:26)
at com.mathworks.mlwidgets.help.HelpPrefs.<clinit>(HelpPrefs.java:57)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.mlservices.MLHelpServices.getDocRoot(MLHelpServices.java:522)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.getDocrootDirectory(ProductInfoUtils.java:698)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.getAbsolutePath(ProductInfoUtils.java:685)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.parseFile(ProductInfoUtils.java:250)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.parseFiles(ProductInfoUtils.java:310)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.pathChanged(ProductInfoUtils.java:154)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.<init>(ProductInfoUtils.java:80)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.getAllProductsInfo(ProductInfoUtils.java:891)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.<clinit>(ProductInfoUtils.java:66)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.mde.desk.StartupClassLoader$LoadInfo.<init>(StartupClassLoader.java:112)
at com.mathworks.mde.desk.StartupClassLoader.createLoadInfos(StartupClassLoader.java:202)
at com.mathworks.mde.desk.StartupClassLoader.access$500(StartupClassLoader.java:25)
at com.mathworks.mde.desk.StartupClassLoader$2.run(StartupClassLoader.java:223)
at java.lang.Thread.run(Thread.java:748)
Every time i type something this code appears on my screen and i don't know what is resolution for this issue... can somebody help me???
I'm using windows 10 with the latest version of matlab... the r2021a...

Answers (1)

Kiran Felix Robert
Kiran Felix Robert on 12 Jul 2021
Hi Alex,
The "NoClassDefFoundError" error is thrown because MATLAB was not able to locate Java Runtime libraries that are used by the Integrated Development Environment (MATLAB IDE).
There are several possible causes to this issue:
A. The installation is corrupted and there are .jar files missing from the MATLAB installation folder.
B. The classpath.txt file is missing references to Java Runtime libraries.
C. One or several internal MATLAB functions are shadowed by custom functions.
Let us start from the bottom (C):
1. Are there M-files on the MATLAB search path with the same name as internal MATLAB functions?
The search path defines the location where MATLAB looks for an M-file. For example, if I type "plot(1:10)" at the command line, MATLAB looks in all the folders on the search path for an M-file with the name "plot.m". If several files named "plot.m" exist, MATLAB uses the one at the top of the search path (the first one it encounters). If I create my own "plot.m" function and save it in the start-up folder, this file will be at the top of the search path and MATLAB will call it every time "plot" is used in MATLAB. This is what we call "shadowing."
To take a look at the MATLAB search path, execute "pathtool" in the Command Window. This will open up the Set Path window with the list of folders that MATLAB parses. The start-up folder should be at the top.
You can try to restore the search path to the installation default by executing the following commands:
>> restoredefaultpath
>> rehash toolboxcache
>> savepath
However, this will not remove the start-up directory from the MATLAB search path. If the start-up folder contains M-files, try to remove them or move them to another folder which is not on the search path.
2. If the issue still persists, the installation might be corrupted. Remove MATLAB completely and install it again to resolve the issue.

Community Treasure Hunt

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

Start Hunting!

Translated by