How do I fix Java exception occurred in Eclipse?

How do I fix Java exception occurred in Eclipse?

Navigate to Windows > Preferences > Ant > Runtime > Ant Home and select the Ant version required. This post should be active. Both JDK 1-7 and JRE 1.8 were present in the java build path>>library in my situation. JDK 1.7 was deleted, which solved my problem.