MATLAB® segments the Java® class path into a static path and a dynamic path. MATLAB searches the static path before the dynamic path.
MATLAB provides the dynamic path as a convenience for when you develop your own Java classes. You can change class definitions on the dynamic path without restarting MATLAB. Therefore, it is useful to put a user-defined Java class definition on the dynamic path while you develop and debug the class.
While the dynamic path offers greater flexibility in changing the path, Java classes on the dynamic path might load more slowly than classes on the static path. Also, classes on the dynamic path might not behave identically to classes on the static path. If your class does not behave as expected, then use the static path.
After developing a Java class, put the class on the static path. For more information, see Static Path of Java Class Path
To add a class to the dynamic path, use the
javaaddpath functions. To remove an entry, use the
javarmpath function. These functions clear all existing variables and
global variables in the workspace.
Do not put Java classes on the static path if they have dependencies on classes on the dynamic path.