From: Bart Thijs on
Hi,

I've some problems with using my own java package in Matlab.
I've put the jar-package in the static java path.
When I run the javaclasspath command I can see my jar in the list.

After import of the class Matlab fails to use it

The function methodview gives this error:
??? Error using ==> methodsview at 65
No class MyClass can be located or no methods for class MyClass

Can someone help me?

best regards
Bart
From: Yair Altman on
"Bart Thijs" <bart.thijs(a)econ.kuleuven.be> wrote in message <hlq1vj$ffk$1(a)fred.mathworks.com>...
> Hi,
>
> I've some problems with using my own java package in Matlab.
> I've put the jar-package in the static java path.
> When I run the javaclasspath command I can see my jar in the list.
>
> After import of the class Matlab fails to use it
>
> The function methodview gives this error:
> ??? Error using ==> methodsview at 65
> No class MyClass can be located or no methods for class MyClass
>
> Can someone help me?
>
> best regards
> Bart

Either you misspelled your class name (note case sensitivity), or none of your class's methods were declared "public".

Yair Altman
http://UndocumentedMatlab.com
From: Bart Thijs on
Hi Yair,

Thanks for your suggestion but both issues are not the case.
All the methods are public and i used copy/paste.

I find it very difficult that you get no error message from Matlab when importing a java class. Is there a possibility to check for all loaded classes.
I've seen something like [m,x,j]=inmem but this gives only empty arrays.

I've tried to include all the used packages in my jar and I can use this jar succesfully outside of Matlab in a jar so every thing seems to be OK with the jar file.
From: Lei Chen on
"Bart Thijs" <bart.thijs(a)econ.kuleuven.be> wrote in message <hlu5qd$a57$1(a)fred.mathworks.com>...
> Hi Yair,
>
> Thanks for your suggestion but both issues are not the case.
> All the methods are public and i used copy/paste.
>
> I find it very difficult that you get no error message from Matlab when importing a java class. Is there a possibility to check for all loaded classes.
> I've seen something like [m,x,j]=inmem but this gives only empty arrays.
>
> I've tried to include all the used packages in my jar and I can use this jar succesfully outside of Matlab in a jar so every thing seems to be OK with the jar file.

I actually have the same problem when I use a third party jar file. Like what you said, if you run javaclasspath, you will see your jar is there, and when you import, there is nothing wrong. But when you call the classes. it says undefined. I am still trying to solve it.
From: Yair Altman on
"Lei Chen" <chlpd(a)hotmail.com> wrote in message <hnsqss$j0j$1(a)fred.mathworks.com>...
> "Bart Thijs" <bart.thijs(a)econ.kuleuven.be> wrote in message <hlu5qd$a57$1(a)fred.mathworks.com>...
> > Hi Yair,
> >
> > Thanks for your suggestion but both issues are not the case.
> > All the methods are public and i used copy/paste.
> >
> > I find it very difficult that you get no error message from Matlab when importing a java class. Is there a possibility to check for all loaded classes.
> > I've seen something like [m,x,j]=inmem but this gives only empty arrays.
> >
> > I've tried to include all the used packages in my jar and I can use this jar succesfully outside of Matlab in a jar so every thing seems to be OK with the jar file.
>
> I actually have the same problem when I use a third party jar file. Like what you said, if you run javaclasspath, you will see your jar is there, and when you import, there is nothing wrong. But when you call the classes. it says undefined. I am still trying to solve it.


place the jar filepath in your static java classpath. To do this, simply type: "edit classpath.txt" in your Matlab Command Window and after adding your JAR(s) restart Matlab

Yair Altman
http://UndocumentedMatlab.com