java 如何使用 JNLP 将命令行参数传递给应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14116640/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use JNLP to pass command line arguments to the application?
提问by reza
I have a JNLP package for my application. Now I have the need to pass command line arguments to my application. How do I extend my JNLP file to list the command line arguments?
我的应用程序有一个 JNLP 包。现在我需要将命令行参数传递给我的应用程序。如何扩展我的 JNLP 文件以列出命令行参数?
For instance, I need to say java main.class arg1 arg2
and the arg1
and arg2
need to be mentioned as part of JNLP file.
举例来说,我需要说java main.class arg1 arg2
和arg1
,并arg2
需要一提的是JNLP文件的一部分。
回答by Andrew Thompson
Look to the description of the application-desc
Elementfor further details of the argument
element.
有关application-desc
元素的更多详细信息,请查看元素的描述argument
。
The
application
element indicates that the JNLP file is launching an application (as opposed to an applet). ..Arguments can be specified to the application by including one or more nested
argument
elements.
For example:
该
application
元素表示 JNLP 文件正在启动应用程序(与小程序相反)。..可以通过包含一个或多个嵌套
argument
元素来为应用程序指定参数。
例如:
<application-desc main-class="Main">
<argument>arg1</argument>
<argument>arg2</argument>
</application-desc>