The same exception was reported when I tried to use the Ant task for Launch4j. When called using an external configuration file, the XML worked flawlessly; invoking it using the <config>
element did not work.
I created the entire configuration inside my XML Ant build based on the external Launch4j configuration file, used the trial version and error to determine what should be specified as an attribute and what as a hierarchy of elements for the Ant task. In doing this, I also specified all empty string values from XML, such as the errTitle=""
and cmdLine=""
attributes. DO NOT DO IT. Just drop them.
An example based on my working draft:
<target name="launch4j-wrap" depends="init"> <property name="launch4j.dir" location="C:/Program Files (x86)/Launch4j" /> <property name="temp.install.dir.name" value="ExampleApp_installDir"/> <property name="temp.install.dir" value="${dist.dir}/${temp.install.dir.name}/bin" /> <property name="prod.version" value="1.0.0.0"/> <property name="prod.copyright" value="2010-2015"/> <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" /> <launch4j> <config headerType="gui" outfile="${temp.install.dir}/ExampleApp.exe" dontWrapJar="false" jarPath="${temp.install.dir}/ExampleApp.jar" chdir="." priority="normal" downloadUrl="http://java.com/download" stayAlive="false" restartOnCrash="false" icon="path/to/ExampleApp.ico"> <classPath mainClass="org.example.ExampleApp"> <cp>some-jar.jar</cp> <cp>some-other-jar.jar</cp> </classPath> <jre bundledJre64Bit="false" bundledJreAsFallback="false" minVersion="1.7.0" maxVersion="" jdkPreference="preferJre" runtimeBits="64/32" maxHeapSize="1024" /> <versionInfo productVersion="${prod.version}" txtProductVersion="${prod.version}" fileVersion="${prod.version}" txtFileVersion="${prod.version}" copyright="${prod.copyright}" fileDescription="Launches Example App" productName="Example App" companyName="Example Inc." internalName="Flawless Unicorn" originalFilename="ExampleApp.exe" /> </config> </launch4j> </target>
predi source share