pmunsey
Posts: 5
Joined: Thu Jun 22, 2006 9:18 pm

Command line arguments for a Java Product

I'm evaluating Advanced Installer in the hopes of replacing our use of InstallAnywhere for Windows. However I'm stuck trying to force the passing of certain command line arguments to a Java Product. I don't see that there is a way to accomplish this. A Shortcut has an arugments input, but I don't see anything similar for Java Products.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

The best approach would be to define a java system property to hold the persistent attribute of your application. You can do that from the "Edit JVM Parameters" dialog.

So an example of command line will be:

javaw -JAR YourFile.jar -Dconfig="argument here"

From your application you can access that system property using:

System.getProperty("config")

You can find more about setting the attributes of a java program from:
http://java.sun.com/docs/books/tutorial ... index.html

However, if you can't(or don't want to) use the system properties method, the work around will be to create a shortcut for your application that will call your application with the respective command line. You can create a shortcut using the "New Shortcut Wizard".

Regards,
Gigi
_________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
pmunsey
Posts: 5
Joined: Thu Jun 22, 2006 9:18 pm

Gigi,

Thanks for the reply. I realize that there are other ways to get the "arguments" into the application. However, it makes it a harder sell for me if I need to change the application in order to switch install tools.

I had thought of the shortcut method, but it seems like a kludge, especially when our current tool handles this cleanly.

Thanks!
Paul

Return to “Common Problems”