[izpack-user] How do you get installed application to be set with same UI language as the one selected by user during install.

1,158 views
Skip to first unread message

Paul Taylor

unread,
Nov 19, 2013, 10:03:40 AM11/19/13
to us...@izpack.codehaus.org
User selects a install language and proceeds with installation, then
user starts the installed application, and has to pick the language to
user.
Is there an easy way to find out what language the user selected during
install, i.e is it written anywhere so my application can correctly set
the language on first startup

Paul

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Paul Bors

unread,
Nov 19, 2013, 11:50:11 AM11/19/13
to us...@izpack.codehaus.org
Did you try starting your intaller in debug mode to see what variables are
available to you?

Start cmd prompt as Admin so you don't have to rely on the UAC, you can
force your installer to elevate itself if needed.
See <run-privileged/> at
http://docs.codehaus.org/pages/viewpage.action?pageId=148865523

Once in DOS start the installer in trace mode:
C:\>java -DTRACE=true -DSTACKTRACE=true -jar myInstaller.jar

TRACE=true would cause a debug panel to show to the right of your
installer's frame as well as enable a bunch of output to the console.
STACKTRACE=true will print the stack traces generated by izPack to the
console.


You really want TRACE and then scroll through the "Variable settings" to see
all your installer's variables by name and value (you can changed them too,
and see their change history by selecting them and double clicking on them).
Your installer's conditions are under the "Condition settings" tab.

See also:
http://docs.codehaus.org/display/IZPACK/Variables
http://docs.codehaus.org/display/IZPACK/Conditions

Now, there are few variable you might find useful the "SYSTEM_user_language"
which is the language of the JVM and the one you want the "ISO2_LANG" and
respective "ISO3_LANG".

As per http://docs.codehaus.org/display/IZPACK/Variables:
* $ISO2_LANG: the ISO2 language code of the selected langpack.
* $ISO3_LANG: the ISO3 language code of the selected langpack.

Now that we know where those variables are stored, how do you work with
them?
Read the "Access to Variable Substitution System" at:
http://docs.codehaus.org/display/IZPACK/Creating+Panels

Long story short, you need to grab a reference to your installData
(install.xml plus additional user input and etc) and invoke:
String selectedLang =
installData.getVariable(ScriptParserConstant.ISO3_LANG);

You can also achieve the same by calling:
String selectedLang = installData.getLocaleISO3(); // this delegates to the
getVariable() call above

Even more useful to you would be this call:
Locale localeInUse = installData.getLocale();


Now, you should really check out the code of izPack version you use and take
a look over the HelloPanel to understand how you should separate your
business logic from the user interface (be in GUI, CLI or even Automated
installer) so that you can implement all of your installer to support all 3
types of installation.

Read more about those types of installers, the "Unattended installations"
and "Console installations" at:
http://docs.codehaus.org/display/IZPACK/Advanced+Features
http://docs.codehaus.org/display/IZPACK/Unattended+Installations

For each custom panel I have 3 classes. Take for example a CustomPanel:
* CustomPanel extends IzPanel
GUI that handles the UI interaction and delegates work to new
CustomPanelConsoleHelper().runConsole(installData)
* CustomPanelAutomationHelper extends PanelAutomationHelper implements
PanelAutomation
Implements runAutomated() which delegates work to the new
CustomPanelConsoleHelper().runConsole(installData)
* CustomPanelConsoleHelper extends AbstractPanelConsole
Implements runConsole() and actually performs all the work

Look over the code and start at
com.izforge.izpack.installer.bootstrap.Installer#main(String []).

~ Thank you,
Paul Bors

Paul Taylor

unread,
Nov 19, 2013, 1:11:33 PM11/19/13
to us...@izpack.codehaus.org
Hmm, this is all very interesting but I just wanted an answer to a
specific and I assume common request. I'm still no clearer on how to
approach this issue and dont have the time to start gong through the
Izpack source code to work out a solution, and I don't need to worry
about unattended or console installs at the moment.

Hasn't someone done the exact same thing before ?

Paul Bors

unread,
Nov 19, 2013, 2:28:03 PM11/19/13
to us...@izpack.codehaus.org
As stated in the original reply:

Even more useful to you would be this call:
Locale localeInUse = installData.getLocale();

Isn't that what you're looking for?

Paul Taylor

unread,
Nov 19, 2013, 2:55:00 PM11/19/13
to us...@izpack.codehaus.org
On 19/11/2013 19:28, Paul Bors wrote:
> As stated in the original reply:
>
> Even more useful to you would be this call:
> Locale localeInUse = installData.getLocale();
>
> Isn't that what you're looking for?
But where do you make this call from, a custom panel ?
I want to be able to find the language used from my actual application.
Now ive just noticed there is a file called .installationinformation
created after install, looks promising but is there a way I can decode
this ?

Paul Bors

unread,
Nov 19, 2013, 3:02:13 PM11/19/13
to us...@izpack.codehaus.org
I presume you have a panel that configures your application that is being
installed right?
I also presume you're using izPack 5.x and higher, otherwise the API is
different.

Okay, let's back up here for a bit and refer back to the first reply I gave
you:
http://markmail.org/search/?q=list%3Aorg.codehaus.izpack.user#query:list%3Ao
rg.codehaus.izpack.user+page:1+mid:w2ya73exq7ki65ff+state:results

The first part of the reply explains to you how you can set your installer
at runtime to show all the variable in use by setting the TRACE
environmental variable to true.

Again, read the "Access to Variable Substitution System" at:
http://docs.codehaus.org/display/IZPACK/Creating+Panels

Then in your custom panel you make use of the InstallData and invoke:
Locale localeInUse = installData.getLocale();

Then you can do whatever you please with the localeInUse.

If this doesn't make sense to you, show us your code and drop your
installer.xml along with your panel to a drop box then share the link here.

~ Thank you,
Paul Bors

-----Original Message-----
From: Paul Taylor [mailto:paul...@fastmail.fm]
Sent: Tuesday, November 19, 2013 2:55 PM
To: us...@izpack.codehaus.org
Subject: Re: [izpack-user] How do you get installed application to be set
with same UI language as the one selected by user during install.

Paul Taylor

unread,
Nov 19, 2013, 4:00:30 PM11/19/13
to us...@izpack.codehaus.org
On 19/11/2013 20:02, Paul Bors wrote:
> I presume you have a panel that configures your application that is being
> installed right?
> I also presume you're using izPack 5.x and higher, otherwise the API is
> different.
>
> Okay, let's back up here for a bit and refer back to the first reply I gave
> you:
> http://markmail.org/search/?q=list%3Aorg.codehaus.izpack.user#query:list%3Ao
> rg.codehaus.izpack.user+page:1+mid:w2ya73exq7ki65ff+state:results
>
> The first part of the reply explains to you how you can set your installer
> at runtime to show all the variable in use by setting the TRACE
> environmental variable to true.
>
> Again, read the "Access to Variable Substitution System" at:
> http://docs.codehaus.org/display/IZPACK/Creating+Panels
>
> Then in your custom panel you make use of the InstallData and invoke:
> Locale localeInUse = installData.getLocale();
>
> Then you can do whatever you please with the localeInUse.
>
> If this doesn't make sense to you, show us your code and drop your
> installer.xml along with your panel to a drop box then share the link here.
>
> ~ Thank you,
> Paul Bors
>
>
Okay I think I get the gist of that you are saying is:
Create a custom panel that gets the selected language
Then use this to modify the installation to configure application with
said language

I was hoping the selected language was just available somewhere after
install, (or could simply be configured to be somewhere)
Then in my program I could use this value to set the correct UI
language. I would prefer this as it much easier for me to change my code
then to start creating custom panels in izpack

if this is not possible, the plan would be to modify any of the existing
panel such as SimpleFinishPanel to find the user selected language and
write it to a file
Then pick up that file in program on first start up and use that to
configure the correct ui language.

Paul Bors

unread,
Nov 19, 2013, 4:58:59 PM11/19/13
to us...@izpack.codehaus.org
Feel free to extend your FinishPanel and save your variable wherever you
would like.
Then you can use it after the installer run.

~ Thank you,
Paul Bors

-----Original Message-----
From: Paul Taylor [mailto:paul...@fastmail.fm]
Sent: Tuesday, November 19, 2013 4:01 PM
To: us...@izpack.codehaus.org
Subject: Re: [izpack-user] How do you get installed application to be set
with same UI language as the one selected by user during install.

Paul Taylor

unread,
Nov 26, 2013, 3:54:33 PM11/26/13
to us...@izpack.codehaus.org
On 19/11/2013 21:58, Paul Bors wrote:
> Feel free to extend your FinishPanel and save your variable wherever you
> would like.
> Then you can use it after the installer run.
>
Hmm, writing a custom panel is beyond me, I dont even seem to have all
the necessary files in my izpack installatio to build new panels. I've
raised

http://jira.codehaus.org/browse/IZPACK-1019

as this seems like logical functionality for most Izpack installations.

Paul Borș

unread,
Nov 28, 2013, 3:09:15 AM11/28/13
to us...@izpack.codehaus.org, us...@izpack.codehaus.org
You dont need "all the necessary files in your izpack installation to build new panels", you just need to extend the izPanel class and implement what you want. Place the panel in your installer's class path (add it to the jar).

For your use case, extend the FinishPanel, call super() on all methods plus add in your logic to save your installer language.

How do you want to save it? To a properties file? Windows registry?
I'll write the panel for you if you can't do it.

In the mid time start reading (a bit older but self explanatory):

Paul Taylor

unread,
Nov 28, 2013, 4:43:42 AM11/28/13
to us...@izpack.codehaus.org
On 28/11/2013 08:09, Paul Borș wrote:
You dont need "all the necessary files in your izpack installation to build new panels", you just need to extend the izPanel class and implement what you want. Place the panel in your installer's class path (add it to the jar).

For your use case, extend the FinishPanel, call super() on all methods plus add in your logic to save your installer language.

How do you want to save it? To a properties file? Windows registry?
I'll write the panel for you if you can't do it.

In the mid time start reading (a bit older but self explanatory):
Maybe my infrastructure is wrong,but okay if you could do it that would be great (and not just for me), Im using

SimpleFinishPanel

In fact I'm using

       <panel classname="HelloPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/>
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="ShortcutPanel"/>
        <panel classname="SimpleFinishPanel"/>

So it could be added to any of these, whichever makes most sense

I just want it saved to a file in the same folder as the .installtioninformation file (still dont know if this file can be read in some way - i assume it doesnt contain the language selected), properties format would be a good solution

i.e a file called izpackinstall.properties

with one line

lang=fra

or whatever was chosen

Many thanks

Paul



Paul Bors

unread,
Dec 2, 2013, 5:47:44 PM12/2/13
to us...@izpack.codehaus.org
In your install.xml you could add a locale for each supported language:
   <locale>
        <langpack iso3="eng" />
        <!-- langpack iso3="fra"/>
        <langpack iso3="spa"/>
        <langpack iso3="por"/ 
        Other supported languages -->
    </locale>
This will prompt the user to select the language for the installer.

If you enable -DTRACE on the cmd line when you start the GUI installer you get the right side bar with a list of all the InstallData in use.
Note that your're interested in ISO2_LANG or ISO3_LANG variable value if you wan the langauge selected by the user via the <locale> drop-down, and that you're interested in SYSTEM_lang value if you start the installer with -Dlang=BLABLA.

Create your own MyFinishPanel that look like this:

package com.mycomp.installer.panels.MyFinishPanel;

import com.izforge.izpack.api.data.Panel;
import com.izforge.izpack.api.resource.Resources;
import com.izforge.izpack.gui.log.Log;
import com.izforge.izpack.installer.data.GUIInstallData;
import com.izforge.izpack.installer.data.UninstallDataWriter;
import com.izforge.izpack.installer.gui.InstallerFrame;
import com.izforge.izpack.panels.simplefinish.SimpleFinishPanel;
import com.izforge.izpack.util.Debug;
import java.io.PrintWriter;
import java.util.Locale;

public class MyFinishPanel extends SimpleFinishPanel {
    private GUIInstallData installData;

    public MyFinishPanel(Panel panel, InstallerFrame parent, GUIInstallData installData, Resources resources,
            UninstallDataWriter uninstallDataWriter, Log log) {
        super(panel, parent, installData, resources, uninstallDataWriter, log);
        this.installData = installData;
    }

    @Override
    public void panelActivate() {
        super.panelActivate();

        Locale userLang = installData.getLocale();
        String systemLang = installData.getVariable("SYSTEM_lang");
        try {
// FIXME: Change the file path and name where this is stored
            PrintWriter writer = new PrintWriter("installer.langs", "UTF-8");
            writer.write("userLang=" + userLang.getISO3Language());
            writer.write("systemLang=" + systemLang);
            writer.close();
        } catch (Exception e) {
            if(Debug.isSTACKTRACE()) {
                e.printStackTrace();
            }
            super.emitError(getInstallerFrame().getMessages().get("installer.error"), e.getLocalizedMessage());
        }
    }
}

After that, package MyFinishPanel inside your installer and replace it in your <panels> section of your install.xml.

Simplest way to package those resources in your installer is to create a jar with them all (use maven module) and then use the <jar> tag in your install.xml to merge that jar inside your installer. See:

~ Thank you,
   Paul Bors

Paul Taylor

unread,
Dec 3, 2013, 4:35:13 PM12/3/13
to us...@izpack.codehaus.org
On 02/12/2013 22:47, Paul Bors wrote:
>
>
> After that, package MyFinishPanel inside your installer and replace it
> in your <panels> section of your install.xml.
>
> Simplest way to package those resources in your installer is to create
> a jar with them all (use maven module) and then use the <jar> tag in
> your install.xml to merge that jar inside your installer. See:
> http://docs.codehaus.org/display/IZPACK/Jar
>
> ~ Thank you,
> Paul Bors
>
Okay the problem is not so much with writing the panel code, but with
compiling it !

So I have an Izpack installation as follows,

C:\Apps\Code\Izpack
C:\Apps\Code\Izpack\bin
C:\Apps\Code\Izpack\lib


ectera, I looked on the download page and there was no src based
alternative, but seeing as I'm not modifying any izpack code but
creating my own new panel I dont suppose I need that anyway.

So I created folder C:\Apps\Code\Izpack\custom
Then I create my own panel MyFinishPanel in custom with default package
cd C:\Apps\Code\Izpack\custom
javac -cp
..\lib\izpack-api-5.0.0-rc1.jar;..\lib\izpack-gui-5.0.0-rc1.jar;..\lib\izpack-installer-5.0.0-rc1.jar;..\lib\izpack-util-5.
0.0-rc1.jar;..\lib\izpack-panel-5.0.0-rc1.jar MyFinishPanel.java
jar -cvf izpackcustom.jar MyFinishPanel.class

Added <jar src=" C:\Apps\Code\Izpack\custom\izpackcustom.jar"/> to my
install.xml file
Changed
<panel classname="SimpleFinishPanel"/>
to
<panel classname="MyFinishPanel"/>

In my install.xml

and then ran the installer which failed with

Adding content of jar: /C:/Apps/Code/Izpack/custom/izpackcustom.jar
Adding panel: UNKNOWN (com.izforge.izpack.panels.hello.HelloPanel) ::
Classname : com.izforge.izpack.panels.hello.HelloPanel
Adding panel: UNKNOWN (com.izforge.izpack.panels.licence.LicencePanel)
:: Classname : com.izforge.izpack.panels.licence.LicencePanel
Adding panel: UNKNOWN (com.izforge.izpack.panels.target.TargetPanel) ::
Classname : com.izforge.izpack.panels.target.TargetPanel
Adding panel: UNKNOWN (com.izforge.izpack.panels.packs.PacksPanel) ::
Classname : com.izforge.izpack.panels.packs.PacksPanel
Adding panel: UNKNOWN (com.izforge.izpack.panels.install.InstallPanel)
:: Classname : com.izforge.izpack.panels.install.InstallPanel
Adding panel: UNKNOWN (com.izforge.izpack.panels.shortcut.ShortcutPanel)
:: Classname : com.izforge.izpack.panels.shortcut.ShortcutPanel
Adding panel: UNKNOWN (MyFinishPanel) :: Classname : MyFinishPanel
-> Fatal error :
null
java.lang.NullPointerException
at
com.izforge.izpack.compiler.merge.CompilerPathResolver.getMergeableByPackage(CompilerPathResolver.java:145)
at
com.izforge.izpack.compiler.merge.CompilerPathResolver.getPanelMerge(CompilerPathResolver.java:89)
at
com.izforge.izpack.compiler.packager.impl.PackagerBase.addPanel(PackagerBase.java:290)
at
com.izforge.izpack.compiler.CompilerConfig.addPanels(CompilerConfig.java:1585)
at
com.izforge.izpack.compiler.CompilerConfig.executeCompiler(CompilerConfig.java:323)
at
com.izforge.izpack.compiler.bootstrap.CompilerLauncher.main(CompilerLauncher.java:52)

(tip : use -? to get the commmand line parameters)



Looking at the error I thought I might need to have in a partcilaur
izpack page, but looking at your original example you used

package com.mycomp.installer.panels.MyFinishPanel;

so that doesn't follow

Any ideas ?

Paul Bors

unread,
Dec 3, 2013, 6:11:41 PM12/3/13
to us...@izpack.codehaus.org
Yes, try with this change in your install.xml's <panels> tag:

        <panel classname="HelloPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/> 
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="ShortcutPanel"/>
        <!-- panel classname="SimpleFinishPanel"/ -->
        <panel classname="com.mycomp.installer.panels.MyFinishPane"/>

Paul Taylor

unread,
Dec 4, 2013, 2:39:17 AM12/4/13
to us...@izpack.codehaus.org
On 03/12/2013 23:11, Paul Bors wrote:
Yes, try with this change in your install.xml's <panels> tag:

        <panel classname="HelloPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/> 
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="ShortcutPanel"/>
        <!-- panel classname="SimpleFinishPanel"/ -->
        <panel classname="com.mycomp.installer.panels.MyFinishPane"/>

No, thats not it because I changed the code in your example so it wasn't in the com.mycomp.installer.panels package

Paul

Paul Taylor

unread,
Dec 4, 2013, 7:57:07 AM12/4/13
to us...@izpack.codehaus.org
Hi, thanks got it working in the end seems like izpack doesn't like custom classes that use the default package, if I put it into a package instead and specify the full package name in install.xml
then it works.

<panels>

        <panel classname="HelloPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/>
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="ShortcutPanel"/>
        <panel classname="net.jthink.izpack.panels.JthinkFinishPanel"/>
    </panels>

I modified your example to put installer.langs into the location where the application is installed, because my application can then work this out it cannot if I just put it into the folder it is installed from, added new lines to the end of each value written, and I output 2letter code instead of three letter code because that is what my application uses.

package net.jthink.izpack.panels;


import com.izforge.izpack.api.data.Panel;
import com.izforge.izpack.api.resource.Resources;
import com.izforge.izpack.gui.log.Log;
import com.izforge.izpack.installer.data.GUIInstallData;
import com.izforge.izpack.installer.data.UninstallDataWriter;
import com.izforge.izpack.installer.gui.InstallerFrame;
import com.izforge.izpack.panels.simplefinish.SimpleFinishPanel;
import com.izforge.izpack.util.Debug;
import java.io.*;
import java.util.Locale;

public class JthinkFinishPanel extends SimpleFinishPanel {
    private GUIInstallData installData;

    public JthinkFinishPanel(Panel panel, InstallerFrame parent, GUIInstallData installData, Resources resources,

            UninstallDataWriter uninstallDataWriter, Log log) {
        super(panel, parent, installData, resources, uninstallDataWriter, log);
        this.installData = installData;
    }

    @Override
    public void panelActivate() {
        super.panelActivate();

        Locale userLang   = installData.getLocale();
        String installDir = installData.getVariable("INSTALL_PATH");
        try {
            OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(new File(installDir,"installer.langs")), "UTF-8");
            writer.write("userLang=" + userLang.getLanguage()+"\n");

            writer.close();
        } catch (Exception e) {
            if(Debug.isSTACKTRACE()) {
                e.printStackTrace();
            }
            super.emitError(getInstallerFrame().getMessages().get("installer.error"), e.getLocalizedMessage());
        }
    }
}
thanks again

Paul

Paul Bors

unread,
Dec 4, 2013, 12:01:15 PM12/4/13
to us...@izpack.codehaus.org
It depends on your project's structure.

I for once have different jars, one for the panels and a second for the uninstaller events.
I use maven to stage those 2 maven modules (panels and events) to the installer that are merged via the <jar> tag.

For more on how to do all this see:

My panels are designed for all 3 types of installation, GUI, CLI and Auto thus I have 3 classes for each panel with the real logic in a single one.
Take a look over izPack's source code as is full of examples. Start with a simple panel such as the TargetPanel (GUI) and notice it has TargetPanelConsoleHelper (CLI) and a TargetPanelAutomationHelper (Auto). All of those are stored in a single package (one package per panel).

Have fun!

~ Thank you,
   Paul Bors

Paul Bors

unread,
Dec 4, 2013, 12:10:31 PM12/4/13
to us...@izpack.codehaus.org
Also, looking closer over your code I notice you used:
String installDir = installData.getVariable("INSTALL_PATH");

Originally I used  installData.getVariable("SYSTEM_lang") because you asked for the value of the variable that's passed through the cmd line ie:
java -Dlang=eng ...
which izPack appends a "SYSTEM_" in front of thus "SYSTEM_lang".

You should replace installData.getVariable("INSTALL_PATH") with:
String installDir = installData.getInstallPath();

If you look over the implementation of getInstallPath() you'll notice a call such as:
return getVariable(INSTALL_PATH);

Here INSTALL_PATH comes from com.izforge.izpack.api.data.InstallData.INSTALL_PATH which is a constant defined in an interface that might change with the next version of izPack. Thus, stay away from using hard-coded strings in your panel since those might change in the next version of izPack.

As I mentioned before, look over izPack's code first to learn how to do things better.

~ Thank you,
   Paul Bors

Paul Borș

unread,
Dec 29, 2013, 7:02:03 PM12/29/13
to us...@izpack.codehaus.org, us...@izpack.codehaus.org
You do realize that then .installationinformation file is the user's input serialized right?
Which means that it already contains your language if you select it from the drop down plus all other user input in clear text (including any passwords).

Because passwords are stored in clear text inside the .installationinformation file I had to disable the creation of this file in my installer.

See the "writeinstallationinformation" attribute of the "infoType" in the install.xml schema at:

I advise you learn git, sign up for free at GitHub.com and check out izPack's source code and study it. See https://github.com/izpack/izpack

Now, let's extend SimpleFinishPanel and write the little props file you want.

1) extending the panel
       That's the izPack-panel maven module if you bothered checking out the code from GitHub
1.2) navigate to the https://github.com/izpack/izpack/tree/master/izpack-panel/src/main/java/com/izforge/izpack/panels/simplefinish package com.izforge.izPack.panels.simplefinish and notice that there are 2 panels there
1.3) SimpleFinishPanel.java is the GUI one
1.4) SimpleFinishConsolePanel.java is the CLI one (Command Line Interface)
       Seems to me that the SimpleFinishPanel is missing the Auto (unattended installation mode) panel. Thus if you use the auto install mode you need to create your own.
1.5) to eliminate code duplication let's extend SimpleFinishConsolePanel and call it MySimpleFinishConsolePanel

package com.mycom.my.installer.panels.simplepanel;
// I'm on an iPad, so you figure out the imports

// SimpleFinishConsolePanel IS-A FinishConsolePanel which in turn IS-A AbstractConsolePanel which IS-A ConsolePanel (interface) see https://github.com/izpack/izpack/blob/master/izpack-installer/src/main/java/com/izforge/izpack/installer/console/ConsolePanel.java

public class MySimpleFinishConsolePanel extends SimpleFinishConsolePanel {
   // Look at SimpleFinishConsolePanel and copy it's constructors here since izPack uses Guice for dependency injection (read about Guice online)
       public MySimpleFinishConsolePanel(PanelView<Console> panel) {
          // Delegate the calls to super()
        super(panel);
    }

      // Override the run() declared by ConsolePanel
      @overide
      boolean run(InstallData installData, Properties properties) {
          // Again, delegate to super so that izPack's panels do their magic
          super.run(installData, properties);
          // Call your utility method
          writeLangProps(installData);
      }
    boolean run(InstallData installData, Console console) {
        // Repeat here
        super.run(installData, console);
        writeLangProps(installData);
    }

       // Lets create our own utility method to write the lang properties you want
       // Make this static so that we can access it from the GUI panel later to eliminate code duplication
       public static void writeLangProps(InstallData installData) {
            // Implement your file output and grab the language from installData
       }
}

1.6) Lets create the MySimpleFinishPanel GUI panel used by Swing
package com.mycom.my.installer.panels.simplepanel;
// I'm on an iPad, so you figure out the imports


public class MySimpleFinishPanel extends SimpleFinishPanel {
    // Again, look at SimpleFinishPanel and copy it's constructors here since izPack uses Guice for dependency injection (read about Guice online)
    public MySimpleFinishPanel(Panel panel, InstallerFrame parent, GUIInstallData installData, Resources resources, UninstallDataWriter uninstallDataWriter, Log log) {
          // Delegate the calls to super()
        super(panel, parent, installData, resources, uninstallDataWriter, log);
    }
   // Now that we got our basic panel going,let's make it do something 
* implement what you need in your subclasses. A panel becomes active when the user reaches it
* during the installation process.
*/
    public void panelActivate()  {
        // look at IzPanel and notice the installData is protected, so we can get to it as child class of it
        // Lets call the static method we already have for saving the prop we want
        MySimpleFinishConsolePanel.writeLangProps(installData);
    }
}
       
2) Compile the newly created panels
2.1) Add them to your install.xml
    <panel classname="HelloPanel"/>
    <panel classname="LicencePanel"/>
    <panel classname="TargetPanel"/>
     <panel classname="PacksPanel"/>
     <panel classname="InstallPanel"/>
     <panel classname="ShortcutPanel"/>
/* The magic happens right here when we change to our finish panels */
     <panel classname="com.mycom.my.installer.panels.simplepanel.MySimpleFinishPanel"/>
2.2) Add the new panels myInstallPanels.jar created by your build system and package it inside your izPack installer via the <jar> element in your install.xml
2.3) Adjust your build system to also compile MySimpleFinishPanel and MySimpleFinishConsolePanel. I can't help you here since you should be using Maven and have those panels in your own myInstallPanels module that outputs a jar with them called myInstallPanels.jar as used above
3) Enjoy !!!

Have a great day,
    Paul Bors

Paul Borș

unread,
Dec 29, 2013, 7:13:47 PM12/29/13
to us...@izpack.codehaus.org
On a side note, FinishPanel (not SimpleFinishPanel) has a button that exports the user input as a properties file. You can also call that method instead of MySimpleFinishConsolePanel.writeLangProps(installData);

I'll leave that as exercise for you since this will force you to check out the code from GitHub and look over izPack's source code.

Have a great day,
    Paul Bors

Paul Taylor

unread,
Dec 30, 2013, 3:03:03 PM12/30/13
to us...@izpack.codehaus.org
On 30/12/2013 00:02, Paul Borș wrote:
You do realize that then .installationinformation file is the user's input serialized right?   
Well no I suspected that might contain useful info and did ask the question of if they was a way to interrogate it in an earlier post but got no answer, so okay good to know it can be unserialized but i have it working as described in an earlier post

Which means that it already contains your language if you select it from the drop down plus all other user input in clear text (including any passwords).

Because passwords are stored in clear text inside the .installationinformation file I had to disable the creation of this file in my installer.

See the "writeinstallationinformation" attribute of the "infoType" in the install.xml schema at:

I advise you learn git, sign up for free at GitHub.com and check out izPack's source code and study it. See https://github.com/izpack/izpack

I do know git to a degree , to be honest I appreciate your help with Izpack, but learning the intricacies of Izpack is not top priority for me I have more pressing issues. I just have a handful of particular problems Id like to solve

Paul

Paul Borș

unread,
Dec 31, 2013, 2:54:38 AM12/31/13
to us...@izpack.codehaus.org, us...@izpack.codehaus.org
We'll yes, but to solve your particular problems you must first understand how the framework function to use the more advanced features which you need to tweak.

IzPack is great at what it does but it cannot cover all the use-cases via a few XML files. Sometimes you must take the extra steps and spend a few hours to understand the basics before jumping in.

Then again, those are all left up to you and if your priorities are not allowing time for learning the framework you choose to implement your installer in don't look for an easy way out as most likely there might not be one, otherwise you would have had the solution by now :)

Anyway, I hope my last post was an okay tutorial that walked you through on how to implement your own panels for all types of installation, GUI, CLI and auto.

As for deserializing the .installationincormation you would still need to look over the code to understand how and what is serialized in the first place. Same goes for the XML file FinishPanel generates at the end of the install.

I do think the simplest solution for your problem is to extend the SimpleFinishPanel and implement the business logic you need.

Have a great day,
    Paul Bors

Paul Taylor

unread,
Dec 31, 2013, 5:21:17 AM12/31/13
to us...@izpack.codehaus.org
On 31/12/2013 07:54, Paul Borș wrote:
We'll yes, but to solve your particular problems you must first understand how the framework function to use the more advanced features which you need to tweak.

IzPack is great at what it does but it cannot cover all the use-cases via a few XML files. Sometimes you must take the extra steps and spend a few hours to understand the basics before jumping in.

Then again, those are all left up to you and if your priorities are not allowing time for learning the framework you choose to implement your installer in don't look for an easy way out as most likely there might not be one, otherwise you would have had the solution by now :)

Anyway, I hope my last post was an okay tutorial that walked you through on how to implement your own panels for all types of installation, GUI, CLI and auto.

As for deserializing the .installationincormation you would still need to look over the code to understand how and what is serialized in the first place. Same goes for the XML file FinishPanel generates at the end of the install.

I do think the simplest solution for your problem is to extend the SimpleFinishPanel and implement the business logic you need.

Have a great day,
    Paul Bors
Thanks Paul as i said your earlier solution was fine and has been working for me, I havent looked at the latest post in detail because I only need a Gui installer at the moment

FYI I use it in http://www.jthink.com/songkong/index.jsp

Paul
Reply all
Reply to author
Forward
0 new messages