致命错误:复制骨架安装程序Izpack后出现空指针异常

时间:2017-10-03 19:08:06

标签: java izpack

我正在使用izpack-dist-5.1.2 jar创建一个没有任何java类的简单安装程序,但在编译时它在控制台上抛出以下错误, 我的编译命令是 “C:\ Program Files \ IzPack \ bin>编译D:\ izpack \ MY_INSTALLER \ install.xml -b D:\ izpack \ MY_INSTALLER”

INFO: Copying the skeleton installer
-> Fatal error :
null
java.lang.NullPointerException
    at com.izforge.izpack.util.IoHelper.copyStreamToJar(IoHelper.java:465)
    at com.izforge.izpack.merge.jar.JarMerge.mergeImpl(JarMerge.java:217)
    at com.izforge.izpack.merge.jar.JarMerge.merge(JarMerge.java:172)
    at 
com.izforge.izpack.merge.MergeManagerImpl.merge(MergeManagerImpl.java:73)
        at com.izforge.izpack.compiler.packager.impl.PackagerBase.writeSkeletonInstaller(Pa
ckagerBase.java:484)
       at com.izforge.izpack.compiler.packager.impl.PackagerBase.writeInstaller(PackagerBase.java:407)
    at com.izforge.izpack.compiler.packager.impl.PackagerBase.createInstaller(PackagerBase.java:354)
    at com.izforge.izpack.compiler.Compiler.createInstaller(Compiler.java:161)
    at com.izforge.izpack.compiler.CompilerConfig.executeCompiler(CompilerConfig.java:364)
at com.izforge.izpack.compiler.bootstrap.CompilerLauncher.main(CompilerLauncher.java:55)
(tip : use -? to get the commmand line parameters)

我的install.xml

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<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>
   <appname>Test</appname>
   <appversion>1</appversion>
 </info>
<guiprefs width="600" height="480" resizable="no">
</guiprefs>
<locale>
 <langpack iso3="eng"/>
</locale>
 <panels>
  <panel classname="ShortcutPanel"/>
 </panels>
 <packs>
  <pack name="Test" required="yes">
   <description>Description</description>
  </pack>
 </packs>
 <resources>
  <res src="shortcutSpec.xml" id="shortcutSpec.xml"/>
 </resources>
 <natives>
  <native type="izpack" name="ShellLink_x64.dll"/>
 </natives>
</izpack:installation>

和shotcutSpec.xml:

<shortcuts>
 <programGroup defaultName="SteamNet" location="applications"/>
 <shortcut name = "One Click Wonder"
    target = "$INSTALL_PATH\oneclickwonder.bat"
    commandLine = ""
    workingDirectory= "$INSTALL_PATH"
    description="Minimal Desktop Timer"
    iconFile="$INSTALL_PATH\images\header.png"
    iconIndex="0"
    initialState="noShow"
    programGroup="yes"
    desktop="yes"
    applications="yes"
    startMenu="yes"
    startup="yes"/>
</shortcuts>

感谢并寻求答案。

2 个答案:

答案 0 :(得分:0)

我们必须传递目标路径和jar名称的命令行参数。 我只是改变了下面的编译机制。

C:\Program Files\IzPack\bin>compile D:\izpack\MY_INSTALLER\install.xml -b 
   D:\izpack\MY_INSTALLER -o D:\myapp_install.jar -k standard

参考:https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/35291145/Compiling+Using+a+Script+On+The+Command+Line

答案 1 :(得分:0)

如果您以“管理”权限打开命令提示符,然后运行compile命令,则它应该可以工作。

使用管理员权限打开命令提示符,然后转到 C:\ Program Files \ IzPack \ bin

然后运行编译D:\ izpack \ MY_INSTALLER \ install.xml -b D:\ izpack \ MY_INSTALLER“