JNLP:无法将参数传递给main

时间:2012-06-03 20:44:16

标签: java jnlp java-web-start

我编写了一个只输出args [0]的程序。如果没有args传递给main,那么它将输出“Hello World”

class test {
public test(String str) {
    System.out.println(str);
}
public static void main(String[] args){
    if (args == null || args.length == 0) {
        args = new String[] { "Hello World" };
    }
    new test(args[0]);
}}

在.jnlp文件中,相应的部分写为:

<application-desc main-class="test"/>
  <argument>TEST1</argument>
</application-desc>

然而,在运行此jnlp之后,它输出“Hello World”

有人可以帮我弄清楚是什么原因吗?

1 个答案:

答案 0 :(得分:1)

我通过删除/

中的<application-desc main-class="test"/>解决了这个问题
相关问题