Question

I am creating the installer for my java project using Izpack. Now, my requirement is such that, I want to run the installer by taking user inputs from the properties file, instead of from user interface.

Exploring the Izpack documentation, I found that I can do it with following two commands.

-options-template: to generate a properties file whose name is specified in args[1].

java -jar installer.jar -options-template inputs.properties

-options: to run an installation while reading the properties from the properties file specified in args[1].

java -jar installer.jar -options inputs.properties

But when I am exporting the inputs.properties file with the first command, it is not having the password field that one of my installer panel is having. So, when I have tried to run the installer with the second command after putting the values of the inputs in the inputs.properties, it is giving error for that password value.

Even after adding password field name and value manually in the inputs.properties, installer is not peeking up that value from the properties file.

I was successful in running the installer with taking the inputs from xml file and it was also having password field. But my requirement is to provide inputs in properties file.

Any help will be really helpful to me.

Thanks

Was it helpful?

Solution

This is reported as an open defect in version 5.0. Another user also indicated having this issue in 4.x. I also cannot run a headless install using version 4.3.5 with the -options flag. IzPack Reported Defect

OTHER TIPS

please create "com.izforge.izpack.panels.userinput.UserInputPanelConsole" class, please notice the package path.

public class UserInputPanelConsole extends UserInputPanelConsoleHelper {

public UserInputPanelConsole(Resources resources, ConsolePanels panels) {
    super(resources, panels);
}

public boolean runConsoleFromProperties(InstallData installData, Properties properties){
  boolean result = super.runConsoleFromProperties(installData, properties);
  for (Map.Entry<Object, Object> entry : properties.entrySet()) {
      if (properties.containsKey(entry.getKey())) {
          String value = (String) entry.getValue();
          if(!StringsUtil.isEmptyString(value)){
              installData.setVariable(entry.getKey().toString(), value);
          }
        }
  }
  return result;
}

}

Just as you can see, you force to set the installData variable and this will keep away from the password field setting variable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top