Skip to main content

Command Line parameters and Web Start

1 reply [Last post]
Joined: 2003-12-04

I browsed this forum and did not find a satisfying answer to the above problem. We are cooperating with a company, that wants to start our Java application by issuing a command line command along with some parameters.

Our application is deployed using Java Web Start and using a jsp is not feasible. The question is, how do I get my application to recognize the commands issued by our partner?

They would prefer to issue something like: launcher.exe -cmd1 -cmd2 -cmd3. The only thing I can think of is to write a small Java program, invoke a call to Runtime.exec("start javaws myapp.jnlp") and let my application (which could of course optionally be wrapped into an exe) modify the .jnlp file first. Any better ideas, any problems I do not see?

Thanks, Aloys

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-05-05

javaws.exe is already a launcher that takes command line arguments including the jnlp file which points to your java application.

To find out the command line arguments supported by javaws, just execute /bin/javaws.exe then a help screen will be shown.

Your partners can either directly launch your application by using javaws directly:
javaws [run-option]

or invoke this command line from another program (say, their own application), be it or java.
e.g: sysExec(javaws, cmdargv); // C
Runtime.exec("javaws.exe myapp.jnlp"); // for java

You do not need to wrap your java application into an exe.
The jnlp should be prepared ahead to point to your java application's *.class.

Why do you think you need your java app to modify *.jnlp?