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:
Calling Matlab functions from java

Subject: Calling Matlab functions from java

From: Ranu Kundu

Date: 9 Mar, 2010 07:25:04

Message: 1 of 3

Hi,
I am tring to develop an interface in JAVA which will call matlab functions.I have followed http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html.But after running the code it is giving the following error:
Exception in thread "Thread-0" java.lang.NoClassDefFoundError: com/mathworks/util/FactoryUtilSupplier
        at MatlabControl.<init>(MatlabControl.java:69)
        at MatlabControl.<init>(MatlabControl.java:63)
        at MatlabControl.<init>(MatlabControl.java:59)
        at testmat$1Call.run(testmat.java:23)
Caused by: java.lang.ClassNotFoundException: com.mathworks.util.FactoryUtilSupplier
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)


Can you please help me out.It is really urgent.

Subject: Calling Matlab functions from java

From: Yair Altman

Date: 9 Mar, 2010 10:10:06

Message: 2 of 3

"Ranu Kundu" <anu.kundu@gmail.com> wrote in message <hn4t4g$nkg$1@fred.mathworks.com>...
> Hi,
> I am trying to develop an interface in JAVA which will call matlab functions. I have followed http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html. But after running the code it is giving the following error:
> Exception in thread "Thread-0" java.lang.NoClassDefFoundError: com/mathworks/util/FactoryUtilSupplier
> at MatlabControl.<init>(MatlabControl.java:69)
> at MatlabControl.<init>(MatlabControl.java:63)
> at MatlabControl.<init>(MatlabControl.java:59)
> at testmat$1Call.run(testmat.java:23)
> Caused by: java.lang.ClassNotFoundException: com.mathworks.util.FactoryUtilSupplier
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)


Try to include the relevant Matlab JAR file. In this case, %matlabroot%/java/jar/util.jar

Yair Altman
http://UndocumentedMatlab.com

Subject: Calling Matlab functions from java

From: Ranu Kundu

Date: 9 Mar, 2010 12:03:02

Message: 3 of 3

yeah,i have tried to include util.jar,but still not working.Do i need to make any change in classpath environment variable?



"Ranu Kundu" <anu.kundu@gmail.com> wrote in message <hn4t4g$nkg$1@fred.mathworks.com>...
> Hi,
> I am tring to develop an interface in JAVA which will call matlab functions.I have followed http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html.But after running the code it is giving the following error:
> Exception in thread "Thread-0" java.lang.NoClassDefFoundError: com/mathworks/util/FactoryUtilSupplier
> at MatlabControl.<init>(MatlabControl.java:69)
> at MatlabControl.<init>(MatlabControl.java:63)
> at MatlabControl.<init>(MatlabControl.java:59)
> at testmat$1Call.run(testmat.java:23)
> Caused by: java.lang.ClassNotFoundException: com.mathworks.util.FactoryUtilSupplier
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>
>
> Can you please help me out.It is really urgent.

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