4

enter image description here So I just installed JRE, JDK and Eclipse and I was trying to run this famous HelloWorld code, but it shows this message as in attached images. What's the ant build?

Thanks!

enter image description here

2
  • Is using Ant mandatory? Or you just need to run the program? Else, right click on the Java file > Run As > Java application. May 20, 2015 at 4:52
  • Did you meddle with Run Configuration?
    – PM 77-1
    May 20, 2015 at 4:52

7 Answers 7

4

dont run it as ant, right click on your file in eclipse select run as then choose java application

0
2

It looks like you don't have your file in your buildpath (what eclipse uses to figure out what files it should compile). Right click on the folder and select Buildpath -> Use as Source folder. Now when you hit run it should hopefully work.

0
  1. Go to Run
  2. Run Configurations
  3. Select Java Application(From Left Pane)
  4. Fill Up Your Project Name and your Main Class
  5. Apply and Run

example image

0

Best way is to Delete all eclipse files in your pc and again download eclipse and install it. Definitely works

0

Click Run As > Java.

If Java is not available there, click Run Configurations > JRE.

Choose "Execution environment" , click Environments and choose the Java version you want to use. Click Apply, Run.

That should do it.

-1

Try to create a Java class file with suitable name and method.This error usually occurs when compiler doesn't understand which file to execute.

1
  • You can clearly see in the OP's screenshot that he has a public class with the required main method.
    – mkl
    Mar 31, 2017 at 6:45
-1

Simply click the javadoc next to your console and run it

1
  • The console is not showing up in the screenshot. Do you mean the javadoc tab at the bottom? Also, why would that work? I don't see any relationship between javadoc and a run configuration. Sep 10, 2021 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.