The cocould not find the main class problem and solution occurs when ant is executed in eclipse.

Source: Internet
Author: User

This usually happens after another copy of Eclipse. Previously, the ant script can be normally executed in eclipse. After the original eclipse is deleted, another copy or new version is changed. The following error occurs in the pop-up window when the ant script is executed:

---------------------------

Java Virtual Machine Launcher

---------------------------

Cocould not find the main class. program will exit.

---------------------------

OK

---------------------------

For those who have used Java, do they still understand that ant's main class cannot be found. But to tell the truth, it has plagued me for a while and I have not gone into depth. To put it bluntly, the crux of the problem is that the ant_home point in eclipse is incorrect.

Solution: In eclipse, choose Window> preferences> ant> runtime. On the classpath tab, the directory pointed to by ANT home entries is incorrect (it still points to the directory you returned, this directory should not exist.) All you need to do is change ant home to the correct directory. Click the ant Home button and select the ant home directory, for example
Eclipse is 3.3.1, and ant home is org. Apache. ant_1.7.0.v200706080842 under the Eclipse plug-in directory.

Now you can execute your ant script in eclipse again. Is it normal!

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.