我正在尝试使用Jarbundler打包我的Java应用程序以在Mac上使用。
由于应用程序是基于maven的应用程序,我使用 mvn ant:ant 命令将其转换为ant;但是,当我运行它时会返回如下错误:
Error: Could not find or load main class com.myproject.swing.Main
的build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyApp" default="package" basedir=".">
<import file="maven-build.xml"/>
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="lib/appbundler-1.0.jar" />
<target name="MyApp">
<bundleapp outputdirectory="dist"
name="MyApp"
displayname="MyApp"
identifier="com.myproject.swing.Main"
mainclassname="com.myproject.swing.Main">
<classpath file="dist/MyApp.jar" />
</bundleapp>
</target>
<!-- ====================================================================== -->
<!-- Help target -->
<!-- ====================================================================== -->
<!-- <target name="help">
<echo message="Please run: $ant -projecthelp"/>
</target> -->
</project>
*主要类位于以下地址
src > main > java > com > myproject > swing > Main
编译器合规性级别为1.8