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

12 次查看(过去 30 天)
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". 

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2021-10-21
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:

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by