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:
Difficulty using own Java Classes

Subject: Difficulty using own Java Classes

From: Tim Edge

Date: 27 Dec, 2009 01:52:03

Message: 1 of 4

Hi all,

I am trying to make use of some java classes I have compiled (including MatlabControl, ref:http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html) and experiencing some difficulty.

What I have done is; edited the classpath to the folder with the class and updated the version of JVM running on Matlab.

It seems that Matlab doesn't recognise any additional classes I want to use. For instance, when i type 'methods('className');' it says no methods or no class. I have tried editing both the static and dynamic classpaths. This is oa problem since MatlabControl objects for instance need to be created from Matlabs JVM.

For background info, i am using Netbeans IDE 6.1 w/ Java 1.6.7 and Matlab ver 7.0 (R14) with JVM updated to 1.6.7.

Is there anything obvious I am missing or need to do. Any help would would be great!

tks,

Subject: Difficulty using own Java Classes

From: Ed Yu

Date: 10 Jan, 2010 18:31:11

Message: 2 of 4

Tim,

Try MATLAB command 'javaclasspath'.

Ed.

Subject: Difficulty using own Java Classes

From: Lee Blanton

Date: 4 Feb, 2010 22:22:04

Message: 3 of 4

I have the same problem. I added to my classpath.txt file the following statement:
E:\PROGRAMMING\SOURCES_Java\Java_User_Libs\com

The javaclasspath command reports this as a valid Java path but none of the .class files under this path are recognized.

Subject: Difficulty using own Java Classes

From: Yair Altman

Date: 5 Feb, 2010 09:54:07

Message: 4 of 4

"Lee Blanton" <lee.blanton@ga-asi.com> wrote in message <hkfhac$frd$1@fred.mathworks.com>...
> I have the same problem. I added to my classpath.txt file the following statement:
> E:\PROGRAMMING\SOURCES_Java\Java_User_Libs\com
>
> The javaclasspath command reports this as a valid Java path but none of the .class files under this path are recognized.

Try placing your class/jar files in the static path (not the dynamic path) and restart Matlab - this usually solves most of these sort of problems. You can also check whether you defined a relevant public constructor - if your constructor is private/protected it is inaccessible from the Matlab command prompt.

Yair Altman
http://UndocumentedMatlab.com

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