Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matlab 6.5 (R13) fails to locate my Java class

Subject: Matlab 6.5 (R13) fails to locate my Java class

From: Roy van den Berg

Date: 17 May, 2010 17:04:05

Message: 1 of 3

I am trying to use a Java class in Matlab 6.5, but Matlab couldn't find it.
I tried the solution proposed in http://www.mathworks.com/support/solutions/en/data/1-1NEETO/index.html?product=ML&solution=1-1NEETO but this didn't work out.

I've added the next line to classpath.txt:
C:\localdata\eclipse workspace\experimentconfiguration\bin

Matlab fails when executing the next line:
experiment = testsuite.TSReader.getExperiment(...)
I receive the error message:
??? Undefined variable 'testsuite' or class 'testsuite.TSReader.getExperiment'.

I've tried the same on another computer running Matlab 7.8.0 (R2009a) with
addclasspath 'C:\localdata\eclipse workspace\experimentconfiguration\bin'
instead of adding a line to classpath.txt and this works.

Can anyone tell me what I'm doing wrong?

Subject: Matlab 6.5 (R13) fails to locate my Java class

From: Yair Altman

Date: 17 May, 2010 19:11:06

Message: 2 of 3

"Roy van den Berg" <rjjvandenberg@gmail.com> wrote in message <hsrsu4$efl$1@fred.mathworks.com>...
> I am trying to use a Java class in Matlab 6.5, but Matlab couldn't find it.
> I tried the solution proposed in http://www.mathworks.com/support/solutions/en/data/1-1NEETO/index.html?product=ML&solution=1-1NEETO but this didn't work out.
>
> I've added the next line to classpath.txt:
> C:\localdata\eclipse workspace\experimentconfiguration\bin
>
> Matlab fails when executing the next line:
> experiment = testsuite.TSReader.getExperiment(...)
> I receive the error message:
> ??? Undefined variable 'testsuite' or class 'testsuite.TSReader.getExperiment'.
>
> I've tried the same on another computer running Matlab 7.8.0 (R2009a) with
> addclasspath 'C:\localdata\eclipse workspace\experimentconfiguration\bin'
> instead of adding a line to classpath.txt and this works.
>
> Can anyone tell me what I'm doing wrong?

One possibility is that your testsuite package uses (imports) classes or JAR files that are missing from your Matlab 6.5 Java classpath (type javaclasspath in your Matlab prompt to check), but which are present in your R2009a environment. Unfortunately, the Matlab classloader issues a very misleading generic error message in such a case. As far as I know, this has not been reported on CSSM or elsewhere until now. I'll report this as a bug in a moment.

Please note that I am not saying this is definitely the cause of your problem - only that this is a potential cause that would explain the symptoms you've reported. If I'm correct, the simple solution is to simply add the dependent classes and JARs using the javaaddpath function, or to add them to classpath.txt.

Yair Altman
http://UndocumentedMatlab.com

Subject: Matlab 6.5 (R13) fails to locate my Java class

From: Roy van den Berg

Date: 21 May, 2010 08:49:08

Message: 3 of 3

Thanks for your response. I'll find a way to work around this problem. Many ways lead to Rome...

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us