Why do I get an 'Undefined variable "com" or class' error when running a toolbox from File Exchange?

8 views (last 30 days)
I have downloaded a zip file from File Exchange, extracted the directory, and opened the directory from MATLAB. I run the toolbox command and encounter the following error:
"Undefined variable "com" or class "com.xxx.xxx". 

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 21 Oct 2021
Edited: MathWorks Support Team on 21 Oct 2021
The error is encountered when a java dependency is not detected in the Java class path. This may happen when the toolbox is not fully added to MATLAB.
To add a zipped File Exchange toolbox to MATLAB, the general process is as follows:
1. Extract the ZIP file
2. From the "Current Folder" window in MATLAB, right-click on the extracted folder and select "Add to Path", then "Selected Folders and Subfolders"
Certain toolboxes may contain additional JAR files that need to be added to the JAVACLASSPATH for the toolbox to run correctly.
You can add the JAR files to the dynamic class path using the 'javaaddpath' command.
To automatically load the JAR files every time MATLAB starts, you can add the jar files to the static class path from the 'javaclasspath.txt' file. You can find more information on how to do so in the following link:

More Answers (0)

Community Treasure Hunt

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

Start Hunting!