The solution is in the opinion of a foreigner's blog. Remember my blog for your convenience.
The author explains that ant cannot be used with JRE, but JDK must be used as the runtime JRE. But this does not seem to be the real reason, but this method can solve the problem, the solution is as follows:
Open the menu: Run -- external tool -- External tools...
Open the JRE page on the right and select JDK in separate JRE:. If this option is not available, click installed jres... --- click Add --- to add a JDK entry.
The specific method is:
Enter JRE name: (random) JDK
Find the JDK installation path and enter JRE home directory.
Exit
Go back to the JRE page of external tools... and click exit.
So far, my problem is solved, but write this articleArticleI found that even now, changing the runtime JRE back to JRE does not seem to be a problem, so I personally think it may be a bug of ecplise, before using ant for the first time, you may need to manually specify a runtime JRE. Changing JRE to JDK just completes this step.