从 matlab 调用 java class

Call java class from matlab

我正在尝试从 matlab(2010a) 调用 java class 但无法正常工作。我尝试按照 this 教程进行操作,但没有成功。

public class Helloworld {

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    // TODO code application logic here
    System.out.println( "Hello World!" );
}

1) 我在 netbeans 创建了这个 class 并使用 Java 1.6.0_12 编译了它(与 matlab 2010a 中使用的相同)。 2)我在动态 class 路径添加了生成的 jar 文件,使用这个命令

javaaddpath('C:\Users\xx\Documents\NetBeansProjects\Helloworld\dist\Helloworld.jar');

3) 我使用这个命令创建了一个对象

o = HelloWorld

4) 但是 matlab 显示了这条消息

??? Undefined function or variable 'HelloWorld'.

知道如何解决我的问题吗?

我丢失了包,我没有将(空)参数发送到 main 函数。

我的完整代码:

javaaddpath('C:\Users\xx\Documents\NetBeansProjects\Helloworld\dist\Helloworld.jar');
%call class, inclugind the package!
% o = helloworld.Helloworld;
o = helloworld.Helloworld();
%call java method, including the argument
javaMethod('main', o,[]);