Myeclipse imports the ant project in Think in JAVA 4th, and myeclipse imports the ant Project

Source: Internet
Author: User

Myeclipse imports the ant project in Think in JAVA 4th, and myeclipse imports the ant Project

Copyright Disclaimer: non-commercial reprinting is allowed only when the author and link are specified in front of the body. During reprinting, the body of this article cannot be reduced, modified, or added (including images)

 

 

Think in JAVA provides a lot of source code, but the project is built with ant. You may be confused when using eclipse, netbeans, and other IDE. Here, I will share some of my experiences using ant when reading this book. If you have any omissions, please advise. You are welcome to discuss them with me ~

 

1. Download the source code

The source code in the book, as well as detailed instructions on ANT configuration on the command line interface (both from the original author of the book), I packed them together on the Baidu network disk, so this article mainly introduces how to import the source code in the book under Myeclipse.

Link: http://yun.baidu.com/share/link? Consumer id = 3812332761 & uk = 2216460525

PS: It is recommended that you configure Ant according to the instructions of the author to deepen your understanding. Do not understand the place can refer to the blog written articles, http://www.cnblogs.com/activity-life/archive/2012/07/12/2587266.html

2. Import MySQL 2.1 to create an Ant Project

Open Myeclipse, click File> New> Project..., and select Java Project from Existing Ant Buildfile in the pop-up window.

2.2 select the build. xml file

I don't know why (it's easy to learn). The build. xml build in the Code root directory may fail, and the javac command is not included in it. An error will be reported when importing Myeclipse. Therefore, we recommend that you import build. xml in one of the sub-folders. Here we will introduce the import of the interfaces sub-file as an example.

Figure 1 import build. xml of the sub-Folder interfaces

2.3 run build. xml

Shows the project directory after the import is successful.

Figure 2: Project directory

The build. xml shown in the figure is the build. xml under interfaces. Right-click Run As-> Ant Build (the first one with a shortcut key) to run the default target (Run ). The result is shown in.

3. FAQ1: import the code of the interface section. What about the code of other sections?

Although only the build of interfaces is imported. xml, but we can find that the entire code folder has been imported. If you want to run the code of other chapters, just expand the code and find the build under the corresponding chapter folder. run the xml file.

2. What should I do if I only want to run a piece of code in the chapter?

Take interfaces As an example. For example, if you only want to Run Music5.java, you can right-click Run As-> Ant Build (second, no shortcut key) and change the target. As you can see, the default target is run, we check cancel, then select the target-Music5 you want to Run, and then run.

Using the build. xml in the root directory to clean and re-generate it can solve most of the problems.

If you are prompted that the library file is missing, download the required library file: javaw. jar, xom. jar, swt. jar, pull sit. jar, we will put it in your current jdk/jre/lib/ext directory.

4. To be continued...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.