MyEclipse importing Ant projects in Java programming ideas (Think in Java 4th)

Source: Internet
Author: User

Copyright notice: Only allowed in the text before the author and link to the case of non-commercial reproduction, reproduced in the text of this article can not reduce content, modify content or add content (including pictures)

Java Programming Idea (Think in Java) provides a lot of source code, but the project is built with Ant. For the use of Eclipse,netbeans and other IDE students may be a bit unprepared, here to share some of my reading this book using ant in some of the experience. If the omission of the place also please advise, welcome everyone and I exchange ~

1. Download source code

The source code in the book, as well as the configuration details of using ant in the command line interface (both from the original book author), I have packaged in the Baidu network, so this article mainly introduces how to import the source code in the book under MyEclipse.

Links: http://yun.baidu.com/share/link?shareid=3812332761&uk=2216460525

PS: It is suggested that interested students should configure ant to deepen their understanding according to the author's description document. Can not understand the place to refer to this Bo friend wrote an article, http://www.cnblogs.com/activity-life/archive/2012/07/12/2587266.html

2. MyEclipse Import 2.1 New Ant Project

Open MyEclipse, click File->new->project, and in the pop-up window, select Java Project from Existing Ant buildfile.

2.2 Select Build.xml file

I do not know why (Caishuxueqian), the code root of the Build.xml build will be problematic, and it does not include Javac command, when importing MyEclipse error. Therefore, we recommend that you import one of the subfolders of the Build.xml, here to import interfaces sub-file as an example for further explanation.

Figure 1 Importing subfolders Interfaces Build.xml

2.3 Running Build.xml

After the import is successful, the project catalog looks like the

Figure 2: Engineering Catalog

The Build.xml, shown in the figure, is the build.xml under interfaces, and the right-click Run As->ant Build (the first, with the shortcut key) runs the default target (run). As a result, the description succeeds.

3, FAQ1, import the code of the interface chapter, what about the code of the other chapters?

 Although import only import interfaces Build.xml, but we can find the entire Code folder has also been imported, if you want to run other chapters of code, just expand Code, find the corresponding chapter folder under the Build.xml file to run.

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

Take interfaces as an example, for example, we just want to run Music5.java, we can change the running target by right-clicking the run As->ant Build (second, no shortcut key).

As you can see, the default target is run, we tick cancel, then tick the target-music5 you want to run, then run.

3. Build failed

Using the root directory's build.xml to clean, then regenerate, can generally solve most problems.

If you are prompted for a missing library file, download the required library file: Javaw.jar,xom.jar,swt.jar,javassit.jar We put it in your current Jdk/jre/lib/ext directory.

4 . To be Continued ...

MyEclipse importing Ant projects in Java programming ideas (Think in Java 4th)

Related Article

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.