Creating and Using Java Objects
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Lokesh Ravindranathan
2013년 7월 25일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Java Package Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!