Archiv für die Kategorie ‘izpack’

netbeans: izpack support (2) – configure JAVA_HOME

Mittwoch, 01. November 2006

In the last blog of this series we have added some basic support for IzPack via a module suites build script and an Install script. Now we will edit the scripts to make the installer a little more useful. I don’t now how I could tell the Installer to unzip the file we have added, so we’ll use ant to unzip the distribution file generated by the build-zip task. Afterwards we will edit the IzPack-installer.xml to pack it again.

1. Add a new target “build-unzip” to your modules build.xml and alter the izpack target to depend on it

8<—————————–Publish Entry———————->8

  <target name="build-unzip" depends="build,build-launchers,build-zip" description="Unpack a ZIP distribution of the suite.">
        <unzip dest="dist" src="dist/${app.name}.zip"/>
    </target>
    <target name ="izpack" depends="build,build-launchers,build-zip,build-unzip" description="Create an Installer.">
        <taskdef name="izpack" classpath="${basedir}/lib/standalone-compiler.jar" classname="com.izforge.izpack.ant.IzPackTask"/>
        <echo message="Makes the installer using IzPack"/>
        <izpack input="${basedir}/IzPack-install.xml"
                output="${basedir}/IzPack-install.jar"
                installerType="standard"
                basedir="${basedir}"
                izPackDir="${basedir}/"/>
    </target>

8<—————————————————>8

2. Alter the IzPack-install.xml to pack the directories . Replace the occurrences of <yourapp-name> by your applications name:

8<——————IzPack-install.xml———————-8

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<installation version="1.0">
    <info>
        <appname><yourapp-name> Installation</appname>
        <appversion>1.0 beta</appversion>
        <authors>
            <author name="Anton Epple" email="epple@genomatix.de"/>
        </authors>
        <url>http://www.genomatix.de</url>
    </info>
    <guiprefs width="640" height="480" resizable="no"/>
    <locale>
        <langpack iso3="eng"/>
    </locale>
    <resources>
        <res id="LicencePanel.licence" src="license.txt"/>
    </resources>
    <panels>
        <panel classname="HelloPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/>
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="FinishPanel"/>
    </panels>
    <packs>
        <pack name="Base" required="yes">
            <description>The base files</description>
            <file src="license.txt" targetdir="$INSTALL_PATH"/>
            <file src="dist/<yourapp-name>" targetdir="$INSTALL_PATH"/>
            <file src="<yourapp-name>.conf" targetdir="$INSTALL_PATH/<yourapp-name>/etc/"/>
            <parsable targetfile="$INSTALL_PATH/bibliosphere/etc/<yourapp-name>.conf"/>
        </pack>
    </packs>
</installation>
8<------------------------------------------------------------8

The new file definition for <yourapp-name>.conf will overwrite the default file. The parsable tag indicates that your <yourapp-name>.conf contains variables that the installer will replace with their values during the installation.

3. Now you need to supply this file (<yourapp-name>.conf) and add it to your module suites root dir:

8<----------------<yourapp-name>.conf-------------------8
 # ${HOME} will be replaced by JVM user.home system property
default_userdir="${HOME}/.${APPNAME}/dev"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/dev"

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="-J-Xms24m -J-Xmx64m -J-Dnetbeans.logger.console=true -J-ea"

# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
jdkhome="$JAVA_HOME"

# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#extra_clusters=
8<------------------------------------------------------------8

The $JAVA_HOME variable will be replaced by IzPack with the current Runtime.

4. Now run the install task. The installer built from this will create the correct directory structure. If you install on your own machine the installed application can be launched from the bin directory.

In the next part of this blog series, we will add a wizard for creating the XML-scripts for the installer.

netbeans: izpack support

Sonntag, 29. Oktober 2006

I had a look at the IzPack support project I created a while ago. The plan was to make creating Install scripts more comfortable with a wizard, and to create a visual editor in the long run.

There is FileTypeSupport, a template and some XML binding classes I had created with my schema2beans support. Furthermore I had started to create a wizard to do the basic configuration steps. There is a info element, and the dtd states it may have these elements:

appname, appversion, appsubpath?, authors?, url?, javaversion?, uninstaller?, webdir?, summarylogfilepath?

Here’s my first IzPackVisualPanel for setting these properties:

IzPack Wizard

So the plan is to do something like:

1. Wizard is launched: bind values from template file to generated classes
2. Use data from wizard to customize the binding classes
3. unmarshall to install script
4. use script and add ant task for creating the installer to project

Should not be too hard, I’ll try to work on it the next days.

netbeans: IzPack

Samstag, 28. Oktober 2006

IzPack is an installers generator for the Java platform. It produces lightweight installers that can be run on any operating system where a Java virtual machine is available. I was discussing the integration of IzPack to into netbeans with Geertjan at the NUG in munich . I think it would be great to have some support for an installer builder in netbeans, and I found out eclipse already has it. Shouldn’t be too hard to have some basic support, as everythings defined in XML. And the whole stuff is written in java, maybe we can also port the GUI?

I found this thread in an IzPack mailing list, and I posted there too, to find out whether this guy has made any progress:

http://comments.gmane.org/gmane.comp.java.izpack.user/230

If not, I guess I’ll give it a try…