Common methods for creating a project directory:
Myproject <dir>
| -- Lib <dir> -- library directory
| -- Classes <dir> -- target file directory
| -- SRC <dir> -- source file directory
| -- Doc <dir> -- API document directory
| -- Build. xml
In this way, you can leave the desired. jar file to the lib directory, and use the build. xml below to compile it if you are as lazy as I do.
----------
<Project name = "" basedir = "./" default = "C">
<Path id = "p">
<Fileset dir = "lib/">
<Include name = "**/*. Jar"/>
</Fileset>
</Path>
<Target name = "C" depends = "">
<Javac srcdir = "src" destdir = "classes" classpathref = "p"/>
</Target>
</Project>
----------
Note:
The first section defines the path P and Adds all. Jar files under Lib.
The second section calls javac and specifies the classpath as the P defined earlier. compile all. java files in the src directory and put the. Class file into the classes directory.
How to run ant:
Open the command line window, enter the directory where build. XML is located, and enter ant
For more information, see
After the http://ant.apache.org downloads ant and decompress it, open ANT/docs/index.html, and choose manual-> ant tasks-> core tasks from the menu to learn how to use other core tasks
Download ant and decompress it. Open ANT/docs/index.html and choose manual> ant tasks> core tasks from the menu to learn how to use other core tasks.