Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial is provides a step by step creation of an IzPack Installer. You will be creating a simple swing based application.

 

Table of Contents

Object

Create an IzPack Installer using following tools: IzPack, Ant, Bash for GNU/Linux and Microsoft Windows 7.

...

  1. Make sure you're in your new created project folder.
  2. Go to the source folder (src).
  3. Create a Java Class (name used in tutorial: HelloWorld).
  4. Paste the source code block down below to your new created class. This source code is a simple swing based dialog with a PushButton.
  5. Compile and run it.
Code Block
themeRDark
languagejava
titleA Simple Swing Based HelloWorld Application
linenumberstrue
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class HelloWorld extends JFrame {

    public HelloWorld() {
        initUI();
    }

    public final void initUI() {

       JPanel panel = new JPanel();
       getContentPane().add(panel);

       panel.setLayout(null);

       JButton quitButton = new JButton("Hello World");
       quitButton.setBounds(50, 60, 120, 30);
       quitButton.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent event) {
               System.exit(0);
          }
       });

       panel.add(quitButton);

       setTitle("Hello World");
       setSize(300, 200);
       setLocationRelativeTo(null);
       setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                HelloWorld ex = new HelloWorld();
                ex.setVisible(true);
            }
        });
    }
} 

This dialog should popup on the screen:

Image Added

Step 4. - Create An Ant Script

  1. Highlight your project folder .Execute and execute the shortkey CTRL+N.
  2. Go to XML folder and choose XML File.
  3. Name this XML File (build.xml)
  4. Paste the xml code down below to build.xml

...

  1. Run the IzPack jar file (java -jar /path/to/IzPack/Jar)
  2. Follow the installation instructions. Remember the directory where the IzPack Installer Framework has been installed (installation path used in tutorial: /home/user/Desktop/IzPack).
  3. Create two directories. The first directory for the IzPack setting file for the creational process and the second directory for the created generated installer (used in tutorial: /home/user/Desktop/Files4Installer and /home/user/Desktop/HelloWorld).

...

This is a small explanation file.
Info
iconfalse
titleCode Explanation
of the install.xml
  • Tag info defines the meta data of the installer. This information will be placed on the first panel (HelloPanel) of the installer (if the gui version of the installer was executed). The underlying tags are self explanatory.
  • The guiprefs tag defines the size in width and height and resizability of all the gui dialogs
  • The locale tag specifies the language of the generated intaller text.
  • The resources tag defines all resources such an image or a text file to be imported to the installer.
  • The panels tag defines which panels are shown by executing the installer. In other words these are the window dialogs that are shown.
  • The packs tag defines the content to be installed by the installer.
Note

Common mistakes:

  • verify username in the path
  • verify the path to the directory

...

Note

Common mistakes:

  • verify username in the path
  • verify the path to the directory

...

TODO: Create two files in this directory /home/user/Desktop/Files4Installer.

...