Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't compile/run in Eclipse- Java [closed]

I'm trying to compile and run a simple program in Eclipse and whenever I hit run it says select what to run: and theres the option of two ant builds I have no clue what ant builds are or what to do about that.. when i try to run with the ant build it says "build failed: could not find an ant file to run" I have the newest version of java and everything should be working fine but when I can never get past the ant build problem.

Thanks for any advice!

like image 206
Jess Anastasio Avatar asked Mar 02 '14 21:03

Jess Anastasio


People also ask

Why is my java code not compiling?

It means that javac.exe executable file, which exists in bin directory of JDK installation folder is not added to PATH environment variable. You need to add JAVA_HOME/bin folder in your machine's PATH to solve this error. You cannot compile and run Java program until your add Java into your system's PATH variable.

Why can't I run a java program in Eclipse?

java ide to work on eclipse? You need to Import your sources to Eclipse project. Select the src folder and run: Import... > File System > Next, Browse to the location of your sources, make sure to select them.

How do I force Eclipse to recompile?

For Eclipse you can find the rebuild option under Project > Clean and then select the project you want to clean up... that's all. This will build your project and create a new bin folder. Save this answer.

How do I recover a closed project in Eclipse?

To reopen a closed project, in the Package Explorer view, select the closed project and click on the Project menu and select Open Project. Once the project is open its content can be edited using the Eclipse user interface.


1 Answers

First make sure that you made a regular "Java Project", and not something else.

If there's something wrong with the build configuration, which i guess there is, go to: Run > Run Configurations... On the left you will see a list of configurations, make sure your configuration runs as a "Java Application". If not, delete all the configurations by selecting them and then press delete.

If things are fine, your program should run normally

like image 65
Hugo Kerstens Avatar answered Sep 24 '22 14:09

Hugo Kerstens