Pregunta

I am working on packaging Java 7 application for Windows using install4j. In the installation i want to provide a choice to install the application for all users or just for the current user.

¿Fue útil?

Solución

If by installing "for all users" you mean installing to the program files directory, then you can do that by setting the installation directory as runtime.

Add a custom form where you ask the user whether they want to to install it for all users or just the current user. To that form screen, add a "Run script" action that sets the installation directory via

context.setInstallationDirectory(...)

The program files directory is available from

WinFileSystem.getProgramFilesDirectory()

and the home directory from

System.getProperty("user.home")

If you want to install to the program files directory, you need elevated privileges. By default, install4j projects have a "Request privileges" action in the startup node of the installer. Move that action before the above "Run script" action and set its condition expression so that it is only executed for the "all users" case.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top