[izpack-users] Exception when adding an Uninstaller (was) Re: Re: Integrating Izpack with eclipse

Jacobo García jacobo.garcia at gmail.com
Wed Aug 30 16:22:08 CEST 2006


Thanks for your help Klaus, I've managed to run the compiler now. I'm using
the standalone compiler at this moment, and it looks that my plugin works
well with it.

By the way I'm Having another problem at this moment.

This is a typical izpack xml file that my plugin generates:

<?xml version="1.0" encoding="UTF-8"?>
<installation version="1.0">
  <info>
    <appname>jaco</appname>
    <appversion>dsfa</appversion>
    <authors>
      <author email="fdasadsf" name="asdfads"/>
    </authors>
    <url>http://www.com.com</url>
    <javaversion>1.5</javaversion>
  </info>
  <guiprefs height="600" resizable="no" width="800"/>
  <resources>
    <res id="InfoPanel.info"
src="/Users/jacobo/Desktop/export/tmp/readme.txt"/>
  </resources>
  <panels>
    <panel classname="HelloPanel"/>
    <panel classname="InfoPanel"/>
    <panel classname="InstallPanel"/>
  </panels>
  <packs>
    <pack name="Main" required="yes">
      <description>Main Pack that does all the installation</description>
      <file dir="/Users/jacobo/Desktop/export/linux.gtk.x86" os="unix"
override="true" targetdir="/opt/jaco"/>
      <file dir="/Users/jacobo/Desktop/export/win32.win32.x86" os="windows"
override="true" targetdir="c:\Program Files\jaco"/>
      <file dir="/Users/jacobo/Desktop/export/macosx.carbon.x86" os="mac"
override="true" targetdir="/Applications/jaco"/>
    </pack>
  </packs>
</installation>


When running this file, I get a null pointer exception, this is the code:

Caused by: java.lang.NullPointerException
    at org.apache.tools.ant.Task.log(Task.java:346)
    at com.izforge.izpack.ant.IzPackTask.packagerMsg(IzPackTask.java:142)
    at com.izforge.izpack.compiler.Packager.sendMsg(Packager.java:242)
    at com.izforge.izpack.compiler.Packager.addResource(Packager.java:371)
    at com.izforge.izpack.compiler.Compiler.addResource(Compiler.java:408)
    at com.izforge.izpack.compiler.CompilerConfig.addInfo(
CompilerConfig.java:1195)
    at com.izforge.izpack.compiler.CompilerConfig.executeCompiler(
CompilerConfig.java:310)
    at com.izforge.izpack.ant.IzPackTask.execute(IzPackTask.java:234)
    ... 67 more
--- Nested Exception ---

Looking at izpack source code, the exception comes in CompilerConfig.java,
in this portion of code:

 XMLElement uninstallInfo = root.getFirstChildNamed("uninstaller");
        if (validateYesNoAttribute(uninstallInfo, "write", YES))
        {
        /* thisline gives the error*/  URL url =
findIzPackResource("lib/uninstaller.jar", "Uninstaller", root);
            compiler.addResource("IzPack.uninstaller", url);

            if (uninstallInfo != null)
            {
                String uninstallerName = uninstallInfo.getAttribute("name");
                if (uninstallerName != null && uninstallerName.endsWith
(".jar")
                        && uninstallerName.length() > ".jar".length())
                    info.setUninstallerName(uninstallerName);
            }
        }

This happens if I include uninstall element on the xml or not. It looks like
it does not find uninstaller.jar, So I tried to add it to the same folder
where standalone-compiler.jar is. But did not worked.

¿Is this a Bug?

On 8/30/06, Bartz, Klaus <Klaus.Bartz at coi.de> wrote:
>
>
> Hi Jacobo,
> I think only izpackdir is missing in the task, but let us recapitulate:
>
> You need all contents of lib (except standalone-compiler.jar) and bin also
> including the sub dirs e.g. bin/panels.
> Panels jars should be exist there, the subdirs created at building are not
> needed.
>
> Alternate you can use the  standakine-compiler. Then you need nothing more
> because it should contain all.
> If you have custom panels/actions a rebuild will be needed.
>
> IzPack needs to know where are the bin and the lib directory. therefore
the
> ant call should contain
> also izpackdir. My task (used since some years) seems like:
> ...
>   <taskdef name="izpack" classpath="${izpack.home}/lib/compiler.jar"
>     classname="com.izforge.izpack.ant.IzPackTask"/>
> ...
>   <izpack
> input="${installersrc.root}/product/appl/install/IzPackProjects/${
installer.subproject}/install.xml"
>     output="${installerdest.root}/${installer.subproject}/install.jar"
>     installertype="standard"
>     basedir="${installersrc.root}"
>     izpackdir="${izpack.home}/"/>
>
> Alternate:
>
>
> ...
>   <taskdef name="izpack"
> classpath="${izpack.home}/lib/standalone_compiler.jar"
>     classname="com.izforge.izpack.ant.IzPackTask"/>
> ...  <izpack
> input="${installersrc.root}/product/appl/install/IzPackProjects/${
installer.subproject}/install.xml"
>     output="${installerdest.root}/${installer.subproject}/install.jar"
>     installertype="standard"
>     basedir="${installersrc.root}" />
>
> Ant vars are defined at the beginning of the ant script...
>
> If this not work, test with a full IzPack installation.
>
> Hope it helpes
>
>
> Klaus
>
>
>
>
>
> -----Original Message-----
> From: izpack-users-bounces at lists.berlios.de
> [mailto:izpack-users-bounces at lists.berlios.de]On Behalf Of
> Jacobo García
> Sent: Wednesday, August 30, 2006 1:41 AM
> To: izpack-users at lists.berlios.de
> Subject: [izpack-users] Integrating Izpack with eclipse
>
> Hello,
>
> I am developing an Eclipse plugin that creates an installer for Eclipse
RCP
> applications.
>
> I have copied both lib and bin folders from my OS X Izpack (3.9.0.
preview)
> installation into a folder called izpack that is in the root of my plugin
> folder.
>
> The plugin works this way:
>
> The user exports (to a folder, let's call it export folder) an Eclipse RCP
> application with other Eclipse wizard (not my plugin), usually Windows,
Mac,
> and Linux exports are performed with "Eclipse Delta Pack".
>
> Then user runs the plugin I am developing, in this process he chooses the
> export folder, and other parameters like the authors or website.
>
> Then the plugin generates an ant script file and an izpack xml installer
> (named installer.xml). This file is located in a tmp folder located inside
> the export folder. The ant file contains izpack task, and the plugin
> launches the ant task inside the plugin with a specific Eclipse class
called
> AntRunner.
>
> Here is an example of the ant file.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="Installer Generator" default="default" basedir=".">
>     <target name="default" description="Main target">
>
>         <izpack
> input="/Users/jacobo/Desktop/export/tmp/installer.xml"
> output="/Users/jacobo/Desktop/jj- installer.jar"
> installerType="standard"
> basedir="/Users/jacobo/Desktop/export/tmp"/>
>     </target>
> </project>
>
>
> In eclipse you can register ant tasks in a file called plugin.xml, so you
> don't have to use  taskdef in order to define tasks, that's what I've done
> with the code shown above.
>
> The problem is that I am getting the famous - You have misspelt 'izpack'.
-
> ant exception. I am wondering if I do have to register more izpack tasks
> that IzPackTask depends on. I looked at izpack sources and IzPackTask only
> depends on other classes that are inside compiler.jar. To be totally sure,
I
> created a little test ant task jar file, and tried to add it to plugin.xml
> the same way I do with izpack ant tasks, and this worked fine.
>
> Here it comes my first question, am I missing something? some izpack
folder?
> some .jar?
>
>
>
> Also I tried to add the taskdef code to my ant task, so right now ant task
> looks this way.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="Installer Generator" default="default" basedir=".">
>
>     <taskdef name="izpack"
> classpath="/Users/jacobo/Documents/workspace/Eclipse
> Installer Generator/izpack/lib/compiler.jar" classname="
> com.izforge.izpack.ant.IzPackTask" />
>     <target name="default" description="Main target">
>
>         <izpack
> input="/Users/jacobo/Desktop/export/tmp/installer.xml"
> output="/Users/jacobo/Desktop/jacobo- installer.jar"
> installerType="standard"
> basedir="/Users/jacobo/Desktop/export/tmp"/>
>     </target>
> </project>
>
> This way I am getting this exception: A class needed by class
> com.izforge.izpack.ant.IzPackTask cannot be found:
>
> I am not sure what is wrong in this second file, something related to
> basedir?
>
> That's all, I can show you all the code if you find it necessary.
>
> Thanks for your attention, and please accept my apologies about my bad
> english.
>
> --
> Jacobo García López de Araujo
> _______________________________________________
> izpack-users mailing list
> izpack-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-users
>
>
>


-- 
Jacobo García López de Araujo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.berlios.de/pipermail/izpack-users/attachments/20060830/02741bfa/attachment.html 


More information about the izpack-users mailing list