f



How to run my java code in matlab

i have a java program having two classes named A_1 and A2 in it and generate two class files as;

A_1.java

A_1.class
A2.class


my matlab supports the java version 1.6.0_17 and i had also have JRE 1.6.0_17.

and i had also copy the path of java and class files in matlab classpath file.

But when i create its object o=A_1

then the following error occurs:

Undefined function or variable 'A_1'.

please help me in this????
0
Deepak
10/29/2015 11:18:03 AM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
852 Views

Similar Articles

[PageSpeed] 55


"Deepak Gupta" <myself.deepakgupta@gmail.com> wrote in message 
news:n0sv9b$o0a$1@newscl01ah.mathworks.com...
> i have a java program having two classes named A_1 and A2 in it and 
> generate two class files as;
>
> A_1.java
>
> A_1.class
> A2.class
>
>
> my matlab supports the java version 1.6.0_17 and i had also have JRE 
> 1.6.0_17.
>
> and i had also copy the path of java and class files in matlab classpath 
> file.
>
> But when i create its object o=A_1
>
> then the following error occurs:
>
> Undefined function or variable 'A_1'.
>
> please help me in this????

In the release that you're using (the current release R2015b uses a later 
version of Java than the one you mentioned) open the equivalent of this 
documentation page (the "breadcrumbs"[1] are MATLAB > Advanced Software 
Development > Calling External Functions > Call Java Libraries)

http://www.mathworks.com/help/matlab/using-java-libraries-in-matlab.html

It will tell you how to access your Java class and invoke methods on the 
Java objects created in your release. [I don't _think_ much has changed in 
recent releases in this space, but I'm not certain. That's why you should 
access your version's documentation rather than depending on the online 
documentation.]

[1] https://en.wikipedia.org/wiki/Breadcrumb_%28navigation%29

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
Steven
10/29/2015 6:16:24 PM
"Deepak Gupta" wrote in message <n0sv9b$o0a$1@newscl01ah.mathworks.com>...
> i have a java program having two classes named A_1 and A2 in it and generate two class files as;
> 
> A_1.java
> 
> A_1.class
> A2.class
> 
> 
> my matlab supports the java version 1.6.0_17 and i had also have JRE 1.6.0_17.
> 
> and i had also copy the path of java and class files in matlab classpath file.
> 
> But when i create its object o=A_1
> 
> then the following error occurs:
> 
> Undefined function or variable 'A_1'.
> 
> please help me in this????


Try the suggestions listed here: http://undocumentedmatlab.com/blog/java-class-access-pitfalls

Yair Altman 
http://UndocumentedMatlab.com 
 
0
Yair
10/29/2015 7:35:04 PM
Reply: