I'm trying to import a custom Java class into matlab. I found this SO Question that I followed.
I have the following Java code
package mypackage.release; public class TestArgu { public void addNumber(int aNumber){ ansNumber = aNumber+5; chk = aNumber; System.out.println("input number = " + chk + ".\n"); System.out.println("ans = " + ansNumber + ".\n"); } public int ansChk(){ return ansNumber; } private int ansNumber; private int chk; } Then I compile with
javac TestArgu.java I make sure I add the folder that contains the TestArgu.class with javaaddpath('.') file and try to call it with matlab.
>> a = mypackage.release.TestArgu(); Undefined variable "mypackage" or class "mypackage.release.TestArgu". >> import mypackage.release.*; >> a = TestArgu(); Undefined function or variable 'TestArgu'. >> a = mypackage.release.TestArgu.addNumber(1); Undefined variable "mypackage" or class "mypackage.release.TestArgu.addNumber". I'm using the same version of java to compile that matlab uses. (JDK 7, Matlab 2013b)
Where am I going wrong ?