MATLAB: Does MATLAB 6.5 (R13) fail to locate the Java class even though I have added it to classpath.txt file

incompatibilityincompatiblejavaMATLABversion

I am trying to use my Java class (called SerialInterface) in MATLAB, and I added the path of that class to classpath.txt file, however, MATLAB could not find that class.
When I try to invoke that class:
SerialInterface
I receive the error message:
??? Undefined function or variable 'SerialInterface'.
When I use the command:
javaObject('SerialInterface')
I receive the same error message.

Best Answer

There is a limitation in MATLAB 6.5 (R13) when calling Java classes that were compiled with a JVM version that does not match MATLAB's JVM version.
To work around this issue, make sure that the JVM version used to compile the Java classes matches MATLAB's JVM version. To see which JVM version MATLAB is using, type the following command at the MATLAB command line:
version -java
You may also consider changing the JVM version that MATLAB uses instead. For more information, refer to the Related Solutions section.
Note : MATLAB is only fully supported with the JVM that it ships with. Some components may not work properly under a different version of the JVM.