需要帮助修复与launch4j相关的JVM错误

时间:2011-06-28 14:00:49

标签: java launch4j

我使用launch4j,Innosetup来创建我的java程序的安装程序。我有6节课。我在launch4j中添加了所有类和所需的jar。 exe通过launch4j创建。我使用innosetup创建了一个安装程序。当我尝试运行安装程序时,发生以下错误...

  

Java虚拟机启动程序

     

找不到主类:JavaSamp了   程序将退出。

任何建议请

的build.xml:

<project basedir="." default="build" name="JavaSamp">
    <target name="build">
        <mkdir dir="classes" />     
        <mkdir dir="install/lib" />
        <jar destfile="install/lib/JavaSamp.jar" basedir="classes" />       
        <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>
        <exec executable="C:\Program Files\Launch4j\launch4jc.exe">
            <arg value="${basedir}\installerLaunch4j.xml" />
        </exec>
        <exec executable="C:\Program Files\Inno Setup 5\ISCC.exe">
            <arg value="${basedir}\InnoSetup.iss" />
        </exec>         
        <echo message="JavaSampSetup.exe ready" />
    </target>
</project>

installerLaunch4j.xml:

<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>
  <manifest></manifest>
  <icon></icon>
  <classPath>
    <mainClass>JavaSamp</mainClass>
    <cp>lib/DataBaseHelper.jar</cp>
    <cp>lib/WriteHelper.jar</cp>
    <cp>lib/FileEncryption.jar</cp>
    <cp>lib/JavaDemo.jar</cp>
    <cp>lib/SendEmail.jar</cp>
    <cp>lib/JavaSamp.jar</cp>
    <cp>lib/JavaSamp$1.jar</cp>
    <cp>lib/JavaSamp$2.jar</cp>
    <cp>lib/JavaSamp$3.jar</cp>
    <cp>lib/JavaSamp$4.jar</cp>
    <cp>lib/JavaSamp$Myemail.jar</cp>
    <cp>lib/JavaSamp$Myemail$1.jar</cp>
    <cp>lib/JavaSamp$Myemail$2.jar</cp>
    <cp>lib/JavaSamp$Myemail$3.jar</cp>
    <cp>lib/JavaSamp$Myemail$4.jar</cp>
    <cp>lib/JavaSamp$OpenL.jar</cp>
    <cp>lib/JavaSamp$Samp.jar</cp>
    <cp>lib/JavaSamp$Samp$1.jar</cp>
    <cp>lib/JavaSamp$Samp1.jar</cp>
    <cp>lib/JavaSamp$Samp1$1.jar</cp>
    <cp>lib/jxl-2.6.jar</cp>
    <cp>lib/ant.jar</cp>
    <cp>lib/sys_data.db</cp>
    <cp>lib/dnsns.jar</cp>
    <cp>lib/dsn.jar</cp>
    <cp>lib/encrypt.data</cp>
    <cp>lib/imap.jar</cp>
    <cp>lib/javaws.jar</cp>
    <cp>lib/jce.jar</cp>
    <cp>lib/jsse.jar</cp>
    <cp>lib/localedata.jar</cp>
    <cp>lib/mail.jar</cp>
    <cp>lib/mailapi.jar</cp>
    <cp>lib/pop3.jar</cp>
    <cp>lib/private.der</cp>
    <cp>lib/public.der</cp>
    <cp>lib/rt.jar</cp>
    <cp>lib/secure.data</cp>
    <cp>lib/SendEmail.jar</cp>
    <cp>lib/smtp.jar</cp>
    <cp>lib/sqlitejdbc-v056.jar</cp>
    <cp>lib/sunjce_provider.jar</cp>
    <cp>lib/sunmscapi.jar</cp>
    <cp>lib/sunpkcs11.jar</cp>
    <cp>lib/tools.jar</cp>
    <cp>lib/unencryptedFile</cp>
    <cp>sys_data.db</cp>
    <cp>lib/install_details.xls</cp>
    <cp>install_details.xls</cp>
  </classPath>
  <jre>
    <path>jre6</path>
    <minVersion></minVersion>
    <maxVersion></maxVersion>
    <jdkPreference>preferJre</jdkPreference>
  </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 final</internalName>
    <originalFilename>JavaSamp.exe</originalFilename>
  </versionInfo>
</launch4jConfig>

2 个答案:

答案 0 :(得分:0)

作为实验,尝试为您的应用程序创建一个JAR文件,并尝试按如下方式运行它:

java -cp your.jar JavaSamp

如果可行,则问题与您创建该安装程序的方式有关。


FWIW,您不需要写java.lang.String。只需String即可。


<强>更新

该异常表示类文件被破坏...或者更可能是它根本不是Java类文件。

答案 1 :(得分:0)

我看到你有“java.lang.ClassFormatError:不兼容的魔法值”异常。

我不能给你直接的答案/解决方案,但我可以补充一点,我以前遇到过这些问题,而且它们与java版本冲突有关。我使用的是java 6和1.4.2,有时会看到这个错误。

您使用的是哪个版本的Java?