使用ant和genJar创建一个可运行的jar

时间:2015-09-10 06:40:24

标签: java ant jar executable-jar

我写了以下蚂蚁目标:

<target name="approval_request_parser_compile">
        <taskdef resource="genjar.properties" classpath="GenJar.jar"/>
        <genjar jarfile="prod/lib/approvalRequestParser.jar">

            <class>
                <fileset dir=".">
                 <include name="com.bet.Check.class"/>
                    <include name="com.bet.Approve.class"/>
                    <include name="com.bet.CheckText.class"/>
                    <include name="com.bet.Request.class"/>
                    <include name="com.bet.ApprovalRequestParser.class"/> #contains the main method
                </fileset>
            </class>
            <classpath>
                <fileset dir="lib">
                    <include name="*.jar" />
                </fileset>
                <pathelement path="."/>
            </classpath>
        </genjar>
    </target>

jar已成功创建,但当我转到/ prod / lib并输入时:

java -jar approvalRequestParser.jar

引发了这个错误:

no main manifest attribute, in approvalRequestParser.jar

有什么想法吗?

0 个答案:

没有答案