开发者

ANT and Netbeans GUI project as executable JAR could not find Main class

I recei开发者_Go百科ve could not ind Main class error message when trying to run jar file. I am using Netbeans 6.9.1 with GUI framework and part of my ANT file is:

<target name="makeJar" depends="compile">
    <delete file="${build.home}/izvrsniProgram.jar"/>
     <jar update="true" destfile="${build.home}/izvrsniProgram.jar" basedir="${build.classes}">
        <zipfileset dir="${lib}" includes="**/*.jar"/>
        <manifest>
            <attribute name="Main-Class" value="oat.DesktopApplication2 "/>
            <attribute name="stos" value="jeste"/>
        </manifest>
    </jar>
</target>

<target name="runJAR">
    <java jar="${build.home}/izvrsniProgram.jar"/>
</target>

Manifest file is in JAR, ANT_HOME is already set, "lib" contains GUI jar framework. Please help me solve this issue... because I think of it day and night and could not find what did I do wrong.


The thing that catches my eye is that you are calling the 'zipfileset' task inside of the 'jar' task. If you are trying to compress the jar file, you can achieve that by using the "compress" and "level" attributes on the 'jar' task.

From the manual page for the 'jar' task on the Ant site...

compress - Not only store data but also compress them, defaults to true. Unless you set the keepcompression attribute to false, this will apply to the entire archive, not only the files you've added while updating.

level - Non-default level at which file compression should be performed. Valid values range from 0 (no compression/fastest) to 9 (maximum compression/slowest). Since Ant 1.7

or if you are just trying to add your dependent jars as one zip archive (why?), you could try to zip the jars into your build directory first, then include the zipped file with a 'fileset'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜