gradle-izpack-plugin icon indicating copy to clipboard operation
gradle-izpack-plugin copied to clipboard

Creating a Windows Installer and Desktop Shortcut

Open Pinto18 opened this issue 6 years ago • 1 comments

Hello.

I've been trying to work through the hello world example shown here . My goal is to learn the plugin so I could apply to a CI/CD pipeline for another project I am working on. I experience no issues running the izPackCreateInstaller task using the defaults. I made slight modifications to the install.xml file that was shown in the example:

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>

<installation version="1.0">
    <info>
        <appname>Hello World Application</appname>
        <appversion>1.0</appversion>
        <authors>
            <author name="Nicholas DiPinto" email="[email protected]"/>
        </authors>
        <url>http://www.hello-world.de/</url>
    </info>

    <guiprefs width="640" height="480" resizable="yes"/>

    <locale>
        <langpack iso3="eng"/>
        <langpack iso3="deu"/>
    </locale>

    <resources>
        <res id="installer.langsel.img" src="images/helloworld_image1.png" />
        <res id="Installer.image" src="images/helloworld_image2.png" />
        <res id="LicencePanel.licence" src="License.txt"/>
        <res id="InfoPanel.info" src="Readme.txt"/>
        <res src="resources/default_shortcut_spec.xml" id="shortcutSpec.xml"/>
    </resources>

    <panels>
        <panel classname="HelloPanel"/>
        <panel classname="InfoPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/>
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="ShortcutPanel"/>
        <panel classname="FinishPanel"/>
    </panels>

    <packs>
        <pack name="HelloWorld" required="yes">
            <description>Hello World Application Runnables</description>
            <file src="C:\Users\dipinton\IdeaProjects\helloWorld\build\classes\java\main\HelloWorld.class" targetdir="$INSTALL_PATH"/>
            <file src="C:\Users\dipinton\IdeaProjects\helloWorld\build\classes\java\main\HelloWorld$1.class" targetdir="$INSTALL_PATH"/>
            <file src="C:\Users\dipinton\IdeaProjects\helloWorld\build\classes\java\main\HelloWorld$2.class" targetdir="$INSTALL_PATH"/>
        </pack>
    </packs>

    <natives>
        <native type="izpack" name="ShellLink.dll" />
        <native type="izpack" name="ShellLink_x64.dll"/>
    </natives>

</installation>

Before adding the lines for creating a desktop shortcut, my issue was that no file was generated that opens up the Hello World program. When I go through the install prompt I create, I get an Uninstaller directory, the .class files, and an optional file from the last panel after clicking on the "Generate an automatic installation script". What I was expecting was a file, like a .exe or a desktop shortcut, that would open up the hello world application. Any idea why I am not seeing this?

Also, any idea why I am having trouble creating a Desktop shortcut? I create the shortcut panel in the install.xml with the natives specified, the resource for the shortcut_spec.xml specified. Those files are located exactly where the plugin expects them to be. However, whenever I run the jar executable and get to the point where the shortcut panel should pop up, I get this error output instead:

could not create shortcut instance
java.lang.Exception: error loading library
java.lang.Exception: can't locate library
        at com.izforge.izpack.util.Librarian.loadArchSpecificLibrary(Unknown Source)
        at com.izforge.izpack.util.Librarian.loadLibrary(Unknown Source)
        at com.izforge.izpack.util.os.ShellLink.initialize(Unknown Source)
        at com.izforge.izpack.util.os.ShellLink.<init>(Unknown Source)
        at com.izforge.izpack.util.os.Win_Shortcut.initialize(Unknown Source)
        at com.izforge.izpack.panels.ShortcutPanel.panelActivate(Unknown Source)
        at com.izforge.izpack.installer.InstallerFrame.switchPanel(Unknown Source)
        at com.izforge.izpack.installer.InstallerFrame.navigateNext(Unknown Source)
        at com.izforge.izpack.installer.InstallerFrame.navigateNext(Unknown Source)
        at com.izforge.izpack.installer.InstallerFrame$NavigationHandler.navigate(Unknown Source)
        at com.izforge.izpack.installer.InstallerFrame$NavigationHandler.access$100(Unknown Source)
        at com.izforge.izpack.installer.InstallerFrame$NavigationHandler$1.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Any reason why izpack can't see the shellLink.dll? Do I need to download the dll somewhere and put it somewhere specific?

Pinto18 avatar Jul 27 '18 15:07 Pinto18

if you are running the installer in a x64 this version of izpack doesn't has the ShellLink_x64.dll

you need to update to izpack 5.1 following this steps:

  • upgrade the dependency

izpack 'org.codehaus.izpack:izpack-dist:5.1.3'

  • upgrade your xml to the new schema
<?xml version="1.0" encoding="iso-8859-1"  ?>
            <izpack:installation version="5.0"
                     xmlns:izpack="http://izpack.org/schema/installation"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://izpack.org/schema/installation http://izpack.org/schema/5.0/izpack-installation-5.0.xsd">

                <info>
                ...

jagedn avatar Jan 24 '19 11:01 jagedn