Adding Log4j library in IzPack Installer

Hi, I have just completed our installer using the IzPack project. I can run the installer as a “Java Application” in Eclipse using the “com.izforge.izpack.installer.Installer” as Main class. It ran well and installed the database, app server, and the solution.

However, the problem arises when I try to execute the jar file as a stand-alone file. I saw the problem when I used “java -jar <installer_file>.jar” to start the installer in command prompt. It threw java.lang.NoClassDefFoundError: org/apache/log4j/spi/AppenderAttachable. I did not have this problem when I executed it in debug mode.

Here are my steps in creating the <installer_file>.jar:

  1. I have recompiled IzPack using build.xml to include my custom panels and placed the compiled classes in in <path_to_compiled_izpack> folder. - No errors in console.
  2. I created the <installer_file>.jar file through “com.izforge.izpack.compiler.Compiler” of the newly compiled IzPack with the following parameters:
    “<path_to_config_files>\jar\install.xml”
    -b “<path_to_config_files>\jar”
    -o “<path_to_config_files>\jar\dist\tsm_7_installer.jar” -h “<path_to_compiled_izpack>_dist”
  • No errors in console.
  1. “java -jar <installer_file>.jar” - log4j error in console

How do I include log4j in the IzPack custom panel? I added ""in “” of the build.xml but still threw an error.

I already fixed the problem.

I added the following lines of code in the build.xml of IzPack.