在Launch4j方面需要帮助

时间:2011-06-16 17:19:45

标签: java launch4j

我有一个创建安装程序的ant文件。我使用了launch4j和innosetup。安装程序已创建。但是我收到了以下错误

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

我的蚂蚁文件是:

<?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>

Launch4j配置文件:

<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>

1 个答案:

答案 0 :(得分:1)

在Launch4J Launch4j JRE Installation or bundled

中使用JRE捆绑或JRE下载功能时,有一些条件需要满足

在你的launch4j脚本中,它只提到名为“jre”的<path>条目,因此你应用的第一个条件导致了这样的错误:

  

<path>       如果存在捆绑的JRE和javaw.exe则运行,否则将停止并显示错误。

尝试使用<minVersion>添加1.6.0条目,看看会发生什么,因为您的设置似乎将JRE捆绑包复制到“install”文件夹中(我将看到您的InnoSetup脚本文件确认)< / p>

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

我希望您的InnoSetup脚本文件中包含以下内容:

[Files]
Source: "install\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;