...
Note: This is not (NOT!) the run() method from the java.lang.Runnable interface. Nor is this codified as an interface in the IzPack javadoc. Instead, this would seem to be a magic method signature that is otherwise undocumented.
a. Contents of a minimal file that matches the requirements:
| Code Block | ||||
|---|---|---|---|---|
| ||||
package org.callimachusproject; |
...
import com.izforge.izpack.util.*; |
...
public class HelloWorld { |
...
public void run(AbstractUIProcessHandler handler, String[] args) { |
...
handler.logOutput("Hello, World!", false); |
...
} |
...
} |
This class uses the com.izforge.izpack.util.AbstractUIProcessHandler class to log output into a calling ProcessPanel. See the IzPack javadoc for details.
...
You will obviously need to include their the standalone-compiler.jar on your classpath, in order to compile your class:
| Code Block | ||||
|---|---|---|---|---|
| ||||
$ javac -cp "/path/to/izpack-standalone-compiler.jar:." org/callimachusproject/HelloWorld.java |
c. Package your Java class into a separate JAR
This is a requirement. IzPack IzPack can only reference a JAR file files not individual class files from a ProcessPanel, not .
| Code Block | ||
|---|---|---|
|
...
| |||
$ jar cvf hello.jar org/callimachusproject/HelloWorld.class |
...
added manifest |
...
adding: org/callimachusproject/HelloWorld.class(in = 470) (out= 316)(deflated 32%) |
...
$ cp hello.jar /path/to/installer/ |
NB: You should eventually use Ant Maven to automate the compilation, packaging and moving of your JAR file.
2. Set up the install.xml file
The install.xml file is the input definition file for the IzPack installer.
...
a. Add <resources> entry.
In the <resources> section of your install.xml, reference an external file called "ProcessPanel.Spec.xml". That
The ProcessPanel.Spec.xml file holds the XML configuration for the external Java class you want to execute. In the
| Code Block | ||
|---|---|---|
|
...
| |||
<installation> ... <resources> <res id="ProcessPanel.Spec.xml" src="installer/ProcessPanel.Spec.xml"/> |
...
... |
...
</resources> |
...
...
</installation>
|
b. Reference your JAR
In the install.xml file's top level, reference the JAR file containing your class.
This is partially documented at:
http://izpack.org/documentation/installation-files.html#the-jar-merging-element-jar
NB: The path to the JAR is the path at *compile time*.
| Code Block | ||||
|---|---|---|---|---|
| ||||
<installation> <resources> <res id="ProcessPanel.Spec.xml" src="installer/ProcessPanel.Spec.xml"/> </resources> ... <jar src="path/to/hello.jar" stage="install"/> .... </installation> |
A good place to put this is near the <resources> definition.
...
In the install.xml file in the panels section, use a ProcessPanel to execute your Java class.
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
<installation> <resources> <res id="ProcessPanel.Spec.xml" src="installer/ProcessPanel.Spec.xml"/> </resources> ... <jar src="path/to/hello.jar" stage="install"/> .... ... <panels> ... <panel classname="ProcessPanel"/> |
...
</panels> .... </installation> |
...
3. Create the ProcessPanel.Spec.xml file
This is partially documented in the old documentation at:
in http://izpack.org/documentation/panels.html#processpanel
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
<processing> <logfiledir>$INSTALL_PATH</logfiledir> |
...
<job name="setup"> |
...
<executeclass name="org.callimachusproject.HelloWorld" |
...
></executeclass> |
...
</job> |
...
<onFail previous="true" next="false" /> |
...
<onSuccess previous="false" next="true" /> |
...
</processing> |
IzPack javadoc
The IzPack javadoc is available in the distribution (although apparently not online). There is an RPM for Linux users.
...