Creating and Using Java Objects
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Consider the following java function : package mypackage; public class MyClassFunc { private MyClassFunc(){ } public static int val() { reurn 1; } } I have successfully compiled my function with NetBeans then I recovered MyClassFunc.class and MyClassFunc.jar in c:\myclassfunc
in Matlab : javaaddpath(fullfile('c:\myclassfunc','MyClassFunc.jar')); When I used methodsview to view class method, I got this error: ??? Undefined variable "mypackage" or class "mypackage".
is that it is a java version problem ? >> version -java
ans =
Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot™ Client VM mixed mode
the one I use for compilation jdk1.7.0_25
0 comentarios
Respuestas (1)
Lokesh Ravindranathan
el 25 de Jul. de 2013
The error in your code is not due to the version of JDK, but how, you add use the function JAVAADDPATH. The solution is available here: http://www.mathworks.com/support/solutions/en/data/1-9FSYXW/index.html?product=SL&solution=1-9FSYXW. In general, however, you will need to use the same version of JDK for compilation.
0 comentarios
Ver también
Categorías
Más información sobre Java Package Integration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!