Tried it: https://blog.csdn.net/bookroader/article/details/2300337
But it doesn't work, I happened to see this article that is not directly related
https://blog.csdn.net/jiuyueguang/article/details/9350753
Think about it. The project is JDK1.5, and Eclipse is started with JDK1.8, so before Run as->Ant build, first Run as->External Tools Configurations, find the Ant Build that reported the error before, and then select Eclipse's JDK to start as shown below. Not the project's JDK.