Passing command line arguments to javaws (Java WebStart) executable

后端 未结 3 627
春和景丽
春和景丽 2020-12-08 23:05

Summary for those who might not want to read that much:

How do I do this: ? If we could pass ad-hoc command-line args to javaws, then javaws apps could be more like

3条回答
  •  执笔经年
    2020-12-08 23:41

    the javaws executable accepts a run-option -arg which allows the called to send arguments to the application. I think these are appended to the arguments in the jnlp file.

    So your call might look like this:

    javaws [options] -arg my_file.jpg http://example.org/launch.jnlp
    

    Edit: The above solution only works with OpenJDK's javaws which accepts the -arg parameter. Another option, according to this blog post, is that you can pass arguments to the JNLP file using URL query string parameters. This will obviously only work if you execute javaws with the full URL and won't work if you access it as a download link. I have not tested this so it may or may not work.

提交回复
热议问题