2

I have an ant file which creates an installer. I used launch4j and innosetup. Installer get created. But I got the following error

This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.

My ant file is:

<?xml version="1.0"?>
<project basedir="." default="build" name="JavaSamp">
    <!--Creation of JavaSampSetup.exe-->
    <target name="build">
        <!-- Creation of classes folder -->
        <mkdir dir="classes" />
        <!-- Compilation of classes -->
        <javac srcdir="src" destdir="classes" />
        <!-- Creation of install/lib -->
        <mkdir dir="install/lib" />
        <!-- Creation of JavaSamp.jar -->
        <jar destfile="install/lib/JavaSamp.jar" basedir="classes" />       
        <!-- Copying process of JRE   -->
        <copy todir="install/jre6">
            <fileset dir="C:\Program Files\Java\jre6">
                <include name="*" />
                <include name="bin/**" />
                <include name="lib/**" />
                <exclude name="lib/charsets.jar" />
                <exclude name="lib/ext/sunjce_provider.jar" />
                <exclude name="bin/rmid.exe" />
                <exclude name="bin/rmiregistry.exe" />
                <exclude name="bin/tnameserv.exe" />
                <exclude name="bin/keytool.exe" />
                <exclude name="bin/kinit.exe" />
                <exclude name="bin/klist.exe" />
                <exclude name="bin/ktab.exe" />
                <exclude name="bin/policytool.exe" />
                <exclude name="bin/orbd.exe" />
                <exclude name="bin/servertool.exe" />
                <exclude name="bin/java.exe" />
                <exclude name="bin/javaws.exe" />
                <exclude name="bin/javacpl.exe" />
                <exclude name="bin/jucheck.exe" />
                <exclude name="bin/jusched.exe" />
                <exclude name="bin/wsdetect.dll" />
                <exclude name="bin/npjava*.dll" />
                <exclude name="bin/npoji610.dll" />
                <exclude name="bin/regutils.dll" />
                <exclude name="bin/axbridge.dll" />
                <exclude name="bin/deploy.dll" />
                <exclude name="bin/jpicom.dll" />
                <exclude name="bin/javacpl.cpl" />
                <exclude name="bin/jpiexp.dll" />
                <exclude name="bin/jpinscp.dll" />
                <exclude name="bin/jpioji.dll" />
                <exclude name="bin/jpishare.dll" />
                <exclude name="lib/deploy.jar" />
                <exclude name="lib/plugin.jar" />
                <exclude name="lib/deploy/messages*.properties" />
                <exclude name="lib/deploy/splash.jpg" />
            </fileset>
        </copy>

        <!-- Creation of JavaSamp.exe using Launch4j -->
        <exec executable="C:\Program Files\Launch4j\launch4jc.exe">
            <arg value="${basedir}\installerLaunch4j.xml" />
        </exec>

        <!--Creation of JavaSamp.exe using Inno Setup-->
        <exec executable="C:\Program Files\Inno Setup 5\ISCC.exe">
            <arg value="${basedir}\installerInnoSetup.iss" />
        </exec>

        <echo message="JavaSamp.exe ready" />
    </target>
</project>

And the Launch4j configuration file:

<launch4jConfig>
  <dontWrapJar>true</dontWrapJar>
  <headerType>gui</headerType>
  <jar></jar>
  <outfile>install\JavaSamp.exe</outfile>
  <errTitle></errTitle>
  <cmdLine></cmdLine>
  <chdir>.</chdir>
  <priority>normal</priority>
  <downloadUrl>http://java.com/download</downloadUrl>
  <supportUrl></supportUrl>
  <customProcName>true</customProcName>
  <stayAlive>false</stayAlive>
  <icon></icon>
  <classPath>
    <mainClass>JavaSamp</mainClass>
    <cp>lib/JavaSamp.jar</cp>
  </classPath>
  <jre>
    <path>jre6</path>
    <minVersion></minVersion>
    <maxVersion></maxVersion>
    <dontUsePrivateJres>false</dontUsePrivateJres>
    <initialHeapSize>0</initialHeapSize>
    <maxHeapSize>0</maxHeapSize>
  </jre>
  <versionInfo>
    <fileVersion>1.0.0.0</fileVersion>
    <txtFileVersion>1.0</txtFileVersion>
    <fileDescription>JavaSamp</fileDescription>
    <copyright>Copyright (c) 2011 Fsp</copyright>
    <productVersion>1.0.0.0</productVersion>
    <txtProductVersion>1.0</txtProductVersion>
    <productName>JavaSamp</productName>
    <companyName>Fsp</companyName>
    <internalName>JavaSamp</internalName>
    <originalFilename>JavaSamp.exe</originalFilename>
  </versionInfo>
</launch4jConfig>
Jonah
  • 9,991
  • 5
  • 45
  • 79
Manikandan
  • 1,479
  • 6
  • 48
  • 89
  • I have not personally run into that error, so I can't tell you the solution immediately. We need to see `installerLaunch4j.xml`. – Jonah Jun 16 '11 at 17:22
  • I have added the installerLaunch4j.xml in my question now. – Manikandan Jun 16 '11 at 17:31
  • @Jack: Does that error come up when the Launch4j builder finishes, or when you try to run the installer? – Jonah Jun 17 '11 at 01:13
  • When I run the installer, at the end that error occurs – Manikandan Jun 17 '11 at 08:12
  • @Jack: Sorry, I got mixed up for a moment there, I mean does it come up when you try to run the launcher? – Jonah Jun 17 '11 at 15:47
  • No, I run the ant build. The installer get created. When I run the installer(exe), at the end that error occurs. – Manikandan Jun 17 '11 at 16:54
  • @Jack: Oh I see, when the Inno Setup installer finishes. Since it the error seems to pertain to the JRE, there might be a problem with the JRE settings in the config XML file. Here's the `` configuration in a program of mine: ` 1.4.0 preferJre ` – Jonah Jun 18 '11 at 00:19

1 Answers1

1

There are certain conditions to be met when using JRE bundled or JRE download feature in Launch4J Launch4j JRE Installation or bundled

In your launch4j script, it only mentions <path> entry named as "jre", so you are applying the first condition which it results in such error:

<path> Run if bundled JRE and javaw.exe are present, otherwise stop with error.

Try to add <minVersion> entry with 1.6.0 and see what happens as it seems that your setup does copy JRE bundle into the "install" folder (I shall see your InnoSetup script file to confirm)

  <jre>
    <path>jre</path>
    <minVersion>1.6.0</minVersion>
    <maxVersion></maxVersion>
    <jdkPreference>jreOnly</jdkPreference>
  </jre>

I hope in your InnoSetup script file has something like this:

[Files]
Source: "install\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; 
Community
  • 1
  • 1
ecle
  • 3,952
  • 1
  • 18
  • 22