N
N
nadom2015-11-08 15:14:46
Java
nadom, 2015-11-08 15:14:46

How to fix an error when starting a project built in ANT?

The project has 4 java files and 1 build file.
When I compile and run it manually through the Windows command line, no spaces appear.
ANT also successfully builds the project (and gives 4 .class files and a .jar archive), but when you try to run the archive or file (java / jar ), it gives an error:
"Could't find or load main class <filename>".
I already looked at the forums, I could not figure it out on my own.
Here is the build file

<project name="NAME" default="all" >
                 <javac includeantruntime="false" srcdir="E:\BSUIR\SITARIS\SITARIS 5\src"/>
         <property name="build.sysclasspath" value="last"/>
         <target name="make.dirs" description="Make some dirs">
                         <mkdir dir="bin"/>
                         <mkdir dir="bin/class"/>
                 </target>

                 <target name="compile" description="compile java" depends="make.dirs">

                             <javac destdir="bin/class">
                                 <src path="src"/>
                         </javac>
                 </target>

                 <target name="stuff.jar" description="make jar file" depends="compile">
                         <jar destfile="bin/stuff.jar">
                         </jar>
                 </target>

                 <target name="all" description="Do the build" depends="stuff.jar"/>
           </project>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danil Antoshkin, 2015-11-08
@TwerTrue

You should specify the main class (from which to start the application launch)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question