문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top