gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 01:45:32 25 4
gpt4 key购买 nike

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

Java Virtual Machine Launcher

Could not find the main class :JavaSamp theprogram will exit.

有什么建议

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>

最佳答案

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

java -cp your.jar JavaSamp

如果可行,则问题出在您创建该安装程序的方式上。


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


更新

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

关于java - 需要帮助修复与 launch4j 相关的 JVM 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6507658/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com