Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use JNLP to pass command line arguments to the application?

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?

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.

like image 544
reza Avatar asked Jan 02 '13 03:01

reza


People also ask

How do you run a Java class from the command line with arguments?

You can also specify command-line arguments in Eclipse using the menu command Run → Run Configurations, choosing the class containing your main() method in the dialog box, then selecting the Arguments tab. Enter your arguments in the Program Arguments box, not the VM Argumentx box.

How does a JNLP file work?

The Java Network Launch Protocol (JNLP) enables an application to be launched on a client desktop by using resources that are hosted on a remote web server. Java Plug-in software and Java Web Start software are considered JNLP clients because they can launch remotely hosted applets and applications on a client desktop.


1 Answers

Look to the description of the application-desc Element for further details of the argument element.

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-desc main-class="Main">
    <argument>arg1</argument>
    <argument>arg2</argument>
  </application-desc>
like image 54
Andrew Thompson Avatar answered Oct 15 '22 03:10

Andrew Thompson