[izpack-users] Problems with search field in UserInputPanel

Bartz, Klaus Klaus.Bartz at coi.de
Tue Oct 10 14:27:56 CEST 2006

Hi Philip,
for the UserInputPanel I can say nothing.
For things you need I use the PathInputPanel (or an
derived class of it). Some times ago I have written
a panel to select a JRE. See above.

You can set a version range in the install.xml using
the IzPack variables "JREPathPanel.minVersion" and
"JREPathPanel.maxVersion". If the VM which is used by the
installation has a version in the range, it will be the default.
The question is,where should the VM be? On my box the 1.3 is on
c:\jdk1.3, the 1.4 is on f:\j2sdk1.4.2_06, the 1.5 is on
F:\Programme\Java\jdk1.5.0_06 and so on. Not so easy to create
a search rule.
You can add to scan the registry on windows. but this need extended
knowledge of java and IzPack.
If a wrong version will be selected, a warning will be placed.
If no VM will be selected, an error will be placed.
I think that is what you need.
Only that this need to handle creation of custom panels can be
a barricade.



package com.izforge.izpack.panels;

import java.io.File;

import com.izforge.izpack.installer.InstallData;
import com.izforge.izpack.installer.InstallerFrame;
import com.izforge.izpack.panels.JDKPathPanel;
import com.izforge.izpack.util.OsVersion;

 * Panel which asks for the JRE path.
public class JREPathPanel extends JDKPathPanel

    private static final String[] testFiles2 = new String[] { "bin" + File.separator + "java"};

    private static final String[] testFiles2W = new String[] { "bin" + File.separator + "java.exe"};

     * The constructor.
     * @param parent The parent window.
     * @param idata The installation data.
    public JREPathPanel(InstallerFrame parent, InstallData idata)
        super(parent, idata);
        if (OsVersion.IS_WINDOWS)


>-----Original Message-----
>From: izpack-users-bounces at lists.berlios.de
>[mailto:izpack-users-bounces at lists.berlios.de]On Behalf Of 
>Philip Reimer
>Sent: Tuesday, October 10, 2006 1:08 PM
>To: IzPack users
>Subject: [izpack-users] Problems with search field in UserInputPanel
>I'm having difficulties with the Search Field in UserInputPanel. I'd
>like to let the user specify the directory of a JRE in the 
>My first question is: how do I get automatic detection working under
>Windows XP? As far as I understood, the <choice value>s specify where
>the installer should have a look for the desired directory? 
>But although
>I have a JRE installed under "C:\Programme\Java" the installer cannot
>find it.
>My second question would be: how do I prevent the user from clicking
>"next" without having specified a JRE directory. As for now, 
>if the user
>leaves the search field empty he can click "next" without any problems.
>Is there some kind of validation mechanism available? Can I somehow
>specifiy the search field as mandatory?
>Thanks in advance.
>PS: Below is my code from userInputSpec.xml:
><field type="search" variable="JAVAHOME">
>			<spec 	id="javahome.input"
>					checkfilename="lib/rt.jar"
>					type="directory" 
>				<choice value="/usr/lib/java/" 
>os="unix" />
>				<choice value="/opt/java" os="unix" />
>				<choice 
>value="C:\Programme\Java" os="windows" />
>				<choice value="C:\Program 
>Files\Java" os="windows" />
>				<choice value="C:\Java" os="windows" />
>			</spec>
>		</field>
>izpack-users mailing list
>izpack-users at lists.berlios.de

More information about the izpack-users mailing list